applyFlat {MAST} | R Documentation

## Apply a vectorized binary operation recycling over last dimension

### Description

When x is an array of order K, and y is an array of order K-1, whose dimensions otherwise agree, apply FUN by recycling y as necessary over dimension K of x.

### Usage

    applyFlat(x, y, FUN = "-")

### Arguments

`x` | array, order K
`y` | array, order K-1
`FUN` | vectorized binary operation

### Value

array, order K equal to FUN(x,y)

### Examples

    ##Dumb example, could be done with scale(...,scale=FALSE)
    x0 = matrix(1:10, nrow=2)
    y0 = rowMeans(x0)
    dim(y0) = c(1, 2)
    x1 = MAST:::applyFlat(x0,y0)
    stopifnot(rowMeans(x1)==0)

[Package MAST version 1.10.0 Index]