na.omit.mat | R Documentation |
Removes rows from a matrix based on the presence of NA values. Can remove rows with any NA values or only those completely filled with NAs.
## S3 method for class 'mat'
na.omit(mat, any = TRUE)
mat |
Input matrix from which rows with NAs are to be omitted. |
any |
Logical; if TRUE (default), removes rows containing any NA values. If FALSE, removes only rows completely filled with NA values. |
A matrix with rows containing NA values omitted according to the specified criteria.
mat <- matrix(c(1, NA, 3, 4, 5, NA, NA, NA, 9), ncol = 3)
na.omit.mat(mat) # Default, any = TRUE
na.omit.mat(mat, any = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.