fm.mapply2R Documentation

Apply a Function to two FlashR vectors/matrices.

Description

fm.mapply2 applies FUN to the first elements of each vector/matrix, the second elements, the third elements, and so on. Two vectors/matrices should have the same shape. Currently, fm.mapply2 only accepts predefined basic operators returned by fm.get.basic.op.

Usage

fm.mapply.row(o1, o2, FUN, set.na = TRUE)

fm.mapply.col(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'fm,fm'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'fmV,fmV'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'fm,fmV'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'fmV,fm'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'fm,matrix'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'matrix,fm'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'fm,ANY'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'ANY,fm'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'fmV,ANY'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

## S4 method for signature 'ANY,fmV'
fm.mapply2(o1, o2, FUN, set.na = TRUE)

Arguments

o1, o2

a FlashR vector/matrix.

FUN

the reference or the name of one of the predefined basic binary operators.

set.na

a logical value indicating whether to set the value in the output matrix to NA if the value in the corresponding location of the input matrix is NA.

Details

fm.mapply.row and fm.mapply.col applies to a matrix and a vector. fm.mapply.row applies FUN element-wise to each row of the matrix in the left argument and the vector in the right argument. fm.mapply.col applies FUN element-wise to each column of the matrix in the left argument and the vector in the right argument.

Value

a FlashR vector/matrix.

Author(s)

Da Zheng <dzheng5@jhu.edu>

Examples

mat <- fm.runif.matrix(100, 10)
res <- fm.mapply.row(mat, runif(10), "+")
res <- fm.mapply.col(mat, runif(100), "+")
mat2 <- fm.runif.matrix(100, 10)
res <- fm.mapply2(mat, mat2, "+")