Description Usage Arguments Details Value Author(s) See Also Examples
Returns the mean of a vector, matrix, or data.frame if it has nomiss proportion of valid cases
1 | meanif(set, nomiss = 0.8, tr = 0)
|
set |
A vector, matrix, or data.frame |
nomiss |
A numeric vector specifying the proporiton of valid cases in set (i.e. data that must not be NA) for the mean to be returned |
tr |
A numeric specifying the amount of trimming if desired |
The built in r function mean includes an na.rm argument that allows the computation of a mean excluding missing cases. However, sometimes one wants to calculate the mean of an object so long as some proportion of those cases are present. The nomiss option of this function allows this capability. If fewer than the nomiss proportion of the cases are invalid (i.e. misssing) the function will return NA. Otherwise, it will return the mean of the valid cases.
Returns the mean.
Ryne A Sherman
1 2 3 4 5 6 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.