Skip to contents

To remove (hide) fields with all NAs

Usage

crunch_fields_remove_na(ds, remove = TRUE)

Arguments

ds

A Crunch Dataset.

remove

Logical. Should NA fields be removed? If set to TRUE it removes it if set to FALSE, it displays the affected field names.

Value

When remove = FALSE, a character vector of field aliases that contain only NA values; otherwise called for its side effect of hiding those fields.

Examples

if (FALSE) { # \dontrun{

library(crunch)
library(haven)

data("ds_survey_example", package = "g6tr.survey")
write_sav(ds_survey_example, path = "temp.sav")
newDataset(x = "temp.sav", name = "survey_example_test")

file.remove("temp.sav")

# Start
ds <- loadDataset("survey_example_test")
unlock(ds)

# Show fields names with all NAs
crunch_fields_remove_na(ds, remove = FALSE)

# Remove all fields with all NAs
crunch_fields_remove_na(ds, remove = TRUE)

# Delete dataset
 deleteDataset(ds)

} # }