
Select variables and apply filters
select_data.RdSelects the variables required for analysis and selects only the rows without missing data for specified variables.
Arguments
- data
Data table - the Health Survey for England dataset.
- ages
Integer vector - the ages in single years to retain (defaults to 8 to 89 years).
- years
Integer vector - the years in single years to retain.
- keep_vars
Character vector - the names of the variables to keep.
- complete_vars
Character vector - the names of the variables on which the selection of complete cases will be based.
Examples
if (FALSE) { # \dontrun{
data <- select_data(data, keep_vars = c("age", "sex", "imd_quintile", "cig_smoker_status"))
} # }