Skip to content

Dealing with NAs in variable options #14

@GabriellaS-K

Description

@GabriellaS-K

Hi
If there are any NAs, then the variable options sets to NA. Is there a way to ignore NA when making the dictionary? see example below:


library(dataMeta)

data("esoph")
my.data <- esoph

# Linker: Add description for each variable names and variable type
variable_description <- c("age group in years", "alcohol consumption in gm/day", 
                          "tobacco consumption in gm/day", "number of cases (showing a range)", 
                          "number of controls (showing range)")

# Add some NA's to row 1
my.data[1, c(2, 3, 4)] <- NA

variable_type <- c(0, 0, 0, 0, 0)
linker <- build_linker(my.data = my.data, variable_description = variable_description, 
                       variable_type = variable_type)

# Replace elements in row 1, columns 2, 3, and 4 with NA


linker

# Data dictionary
# For this data set, no further option description is needed.
dictionary <- build_dict(my.data = my.data, linker = linker, option_description = NULL, 
                         prompt_varopts = FALSE)
dictionary

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions