Description Usage Arguments Details Value Author(s) See Also Examples
A function to perform 'apply' on an matrix of data and corresponding matrix of weights.
1 |
X |
A matrix of data. |
MARGIN |
A vector giving the subscripts which the function will be applied over. 1 indicates rows, 2 indicates columns. |
FUN |
The function to be applied. In the case of functions like
|
W |
An optional matrix of weights. When |
... |
optional arguments to |
When weights are provided, these are passed to FUN
along with the data X
. For example, if FUN=meanX
, each data value is multiplied by the corresponding weight before the mean is applied.
If each call to FUN
returns a vector of length n
, then wapply
returns an array of dimension c(n, dim(X)[MARGIN])
if n > 1
. If n = 1
, wapply
returns a vector if MARGIN
has length 1 and an array of dimension dim(X)[MARGIN]
otherwise. If n = 0
, the result has length 0 but not necessarily the "correct" dimension.
If the calls to FUN
return vectors of different lengths, wapply
returns a list of length dim(X)[MARGIN]
.
This function is used in the package multtest
to compute weighted versions of test statistics. It is called by the function get.Tn
inside the user-level function MTP
.
Katherine S. Pollard
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.