rowGrpNA {wrMisc} | R Documentation |
Count number of NAs per row and group of columns
Description
This functions allows easy counting the number of NAs per row in data organized in multiple sub-groups as columns.
Usage
rowGrpNA(mat, grp)
Arguments
mat |
(matrix of data.frame) data to count the number of |
grp |
(character or factor) defining which columns should be grouped (considered as replicates) |
Value
matrix with number of NA
s per group
See Also
Examples
mat2 <- c(22.2, 22.5, 22.2, 22.2, 21.5, 22.0, 22.1, 21.7, 21.5, 22, 22.2, 22.7,
NA, NA, NA, NA, NA, NA, NA, 21.2, NA, NA, NA, NA,
NA, 22.6, 23.2, 23.2, 22.4, 22.8, 22.8, NA, 23.3, 23.2, NA, 23.7,
NA, 23.0, 23.1, 23.0, 23.2, 23.2, NA, 23.3, NA, NA, 23.3, 23.8)
mat2 <- matrix(mat2, ncol=12, byrow=TRUE)
gr4 <- gl(3, 4, labels=LETTERS[1:3])
# overal number of NAs per row
rowSums(is.na(mat2))
# number of NAs per row and group
rowGrpNA(mat2, gr4)
[Package wrMisc version 1.15.1 Index]