Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rowGrpNA

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 NAs

grp

(character or factor) defining which columns should be grouped (considered as replicates)

Value

matrix with number of NAs 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)

wrMisc

Analyze Experimental High-Throughput (Omics) Data

v1.5.4
GPL-3
Authors
Wolfgang Raffelsberger [aut, cre]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.