Count number of NAs per sub-set of columns
This function will count the number of NA
s per group (defined by argument grp
) while summing over all lines of a matrix or data.frame.
The row-position has no influence on the counting.
Using the argument asRelative=TRUE
the result will be given as (average) number of NA
s per row and group.
sumNAperGroup(x, grp, asRelative = FALSE)
x |
matrix or data.frame which may contain |
grp |
factor describing which column of 'dat' belongs to which group |
asRelative |
(logical) return as count of |
integer vector with count of NA
s per group
NA
, filter NA
s by line presenceFilt
mat <- matrix(1:25, ncol=5) mat[lower.tri(mat)] <- NA sumNAperGroup(mat, rep(1:2,c(3,2))) sumNAperGroup(mat, rep(1:2,c(3,2)), asRelative=TRUE)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.