Skip to contents

This function computes a summary score from an input vector or from each column vector of an input matrix.

Arguments

x

(named) numerical vector or matrix

i

(optional) numerical vector giving the (row) position in x or character vector matching the (row) names in x. If missing or i = NULL, the entire x is considered for the computation of the score

w

numerical vector of weights the same length as nrow(x). It is used for the computation of the weighted scores

na.rm

logical, whether to remove NA values from x before computation

score

character string indicating the summary score to compute

...

further arguments to score

transform.fun

function to transform the data. If provided, x is transformed (x = transform.fun(x, transform.args)) before the computation of the scores. See getDataTransformer for further details about built-in options

transform.args

list of parameters to the data transformation function

transform.sub

logical, whether to transform x after it is subset for i (used to speedup computation). Default is FALSE, meaning the transformation would be applied directly to x provided in input

Value

A numerical value representing the computed score. A default NA value is returned if the score can't be computed, or if i values are not present in x.

Author

Alessandro Barberis