Learn R Programming

dataprep (version 0.1.8)

varidele: Delete variables containing too many missing values

Description

Removes any numeric column whose missing value proportion exceeds a given threshold.

Usage

varidele(data, cols = NULL, fraction = 0.25, verbose = FALSE)

Value

A data frame with the retained columns.

Arguments

data

A data frame or matrix containing numeric columns.

cols

Column indices or names of the numeric columns to consider. If NULL, all columns are used.

fraction

Missing proportion threshold. Columns with a missing fraction >= fraction are deleted. Default 0.25.

verbose

Logical; if TRUE, prints timing and deleted variables.

Author

Chun-Sheng Liang <[email protected]>

Details

The missing fraction is computed after excluding rows where all selected variables are NA. Any column whose missing fraction reaches the threshold is removed, regardless of its position in the selected block.

References

1. Example data is from https://smear.avaa.csc.fi/download. It includes particle number concentrations in SMEAR I Varrio forest.

Examples

Run this code
varidele(data, cols = 5:65)

Run the code above in your browser using DataLab