Description Usage Arguments Value Examples
Selects the variables required for analysis and selects only the rows without missing data for specified variables.
1 2 3 4 5 6 7 | select_data(
data,
ages = 8:89,
years = 2001:2017,
keep_vars = c("age", "sex", "imd_quintile"),
complete_vars = c("age", "sex", "imd_quintile")
)
|
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 (defaults to 2001 to 2016). |
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. |
Returns a reduced version of data
1 2 3 4 5 6 | ## Not run:
data <- select_data(data, keep_vars = c("age", "sex", "imd_quintile", "cig_smoker_status"))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.