combineData {HELP} | R Documentation

## Combine data

### Description

Calculate trimmed and/or weighted means of groups of rows in a given data matrix.

### Usage

    combineData(x, y, w, ...)

### Arguments

`x` | a numeric matrix containing the values whose trimmed and/or weighted mean is to be computed. Each column is treated independently.
`y` | a vector describing the discrete groups used to divide the elements of x. If y is missing then all elements of x are handled together.
`w` | a matrix of weights the same dimensions as x giving the weights to use for each element of x. If w is missing then all elements of x are given the same weight.
`...` | Arguments to be passed to methods (see `combineData-methods`): `trim` the fraction (0 to 0.5, default is 0) of observations to be trimmed from each group of rows in `x` according to `y`. `na.rm` logical; if TRUE, missing values are removed from `x` and `y` and `z`. If FALSE any missing values cause an error. `element` which element of `AssayData` to use for a given `ExpressionSet` input (default is "exprs") `feature.group` which element of `featureData` to use as binning variable (default is `NULL`). Can be a character matching `varLabel` or simply an integer indicating which feature to choose. See `getFeatures`. `element.weight` which element of `AssayData` to use for a given `ExpressionSet` input. If `NULL` (default), weighting is not performed. `feature.weight` which element of `featureData` to use as weighting variable (default is `NULL`). Can be a character matching `varLabel` or simply an integer indicating which feature to choose. See `getFeatures`. `samples` which samples to use as data. Can be a vector of characters matching sample names, integers indicating which samples to choose, or a mixture of the two. If NULL (default), all samples will be used. `...` other arguments not handled at this time.

### Value

Returns a matrix of combined numerical data, where each row represents the summary of a group of elements from the corresponding column in x.

### Note

Each column in data matrix treated separately.

### Author(s)

Reid F. Thompson (rthompso@aecom.yu.edu)

### See Also

`combineData-methods`, `mean`, `weighted.mean`

### Examples

    #demo(pipeline,package="HELP")

    x <- 1:100
    combineData(x,w=x/100)
    weighted.mean(x,w=x/100)

    y <- sample(c("a","b","c",1:3),size=100,replace=TRUE)
    combineData(cbind(x,x,2*x),y,trim=0.5)

    #rm(x,y)

[Package HELP version 1.0.0 Index]