View source: R/filter_dataset.R
| remove_variables_by_nas | R Documentation |
Removes variables with too many missing values.
remove_variables_by_nas(dataset, max.nas = 0, by.percent = FALSE)
dataset |
Dataset to modify. |
max.nas |
Maximum number of missing values allowed. |
by.percent |
Logical. If TRUE, max.nas is treated as a percentage. |
A dataset object with the same structure as the input, where variables whose number of missing values exceeds 'max.nas' have been removed from 'dataset$data'.
data <- matrix(
c(1, 2, 3,
NA, 5, NA,
7, 8, 9),
nrow = 3,
dimnames = list(c("x1", "x2", "x3"), c("s1", "s2", "s3"))
)
metadata <- data.frame(class = c("A", "B", "A"), row.names = c("s1", "s2", "s3"))
dataset <- list(data = data, metadata = metadata)
remove_variables_by_nas(dataset, max.nas = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.