rowNA: Frequency of Missing Values by Row

Description Usage Arguments Value See Also Examples

View source: R/quest_functions.R

Description

rowNA compute the frequency of missing values in a matrix by row. This function essentially does apply(X = x, MARGIN = 1, FUN = vecNA). It is also used by other functions in the quest package related to missing values (e.g., rowMeans_if).

Usage

1
rowNA(x, prop = FALSE, ov = FALSE)

Arguments

x

matrix with any typeof. If not a matrix, it will be coerced to a matrix via as.matrix. The argument rownames.force is set to TRUE to allow for rownames to carry over for non-matrix objects (e.g., data.frames).

prop

logical vector of length 1 specifying whether the frequency of missing values should be returned as a proportion (TRUE) or a count (FALSE).

ov

logical vector of length 1 specifying whether the frequency of observed values (TRUE) should be returned rather than the frequency of missing values (FALSE).

Value

numeric vector of length = nrow(x), and names = rownames(x), providing the frequency of missing values (or observed values if ov = TRUE) per row. If prop = TRUE, the values will range from 0 to 1. If prop = FALSE, the values will range from 1 to ncol(x).

See Also

is.na vecNA colNA rowsNA

Examples

1
2
3
4
5
rowNA(as.matrix(airquality)) # count of missing values
rowNA(as.data.frame(airquality)) # with rownames
rowNA(as.matrix(airquality), prop = TRUE) # proportion of missing values
rowNA(as.matrix(airquality), ov = TRUE) # count of observed values
rowNA(as.data.frame(airquality), prop = TRUE, ov = TRUE) # proportion of observed values

quest documentation built on Sept. 10, 2021, 5:07 p.m.

Related to rowNA in quest...