Learn R Programming

HELP (version 1.30.0)

combineData: 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.

\dots
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.

See Also

combineData-methods, mean, weighted.mean

Examples

Run this code
#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)

Run the code above in your browser using DataLab