extractVars | R Documentation |
GADSdat
.Extract or remove variables and their meta data from a GADSdat
object.
extractVars(GADSdat, vars)
removeVars(GADSdat, vars)
GADSdat |
|
vars |
A character vector containing the variables names in the |
Both functions simply perform the variable removal or extraction from the underlying data.frame
in the GADSdat
object followed by calling updateMeta
.
Returns a GADSdat
object.
## create an example GADSdat
example_df <- data.frame(ID = 1:4,
age = c(12, 14, 16, 13),
citizenship1 = c("German", "English", "Polish", "Chinese"),
citizenship2 = c(NA, "German", "Chinese", "Polish"),
stringsAsFactors = TRUE)
gads <- import_DF(example_df)
## remove variables from GADSdat
gads2 <- removeVars(gads, vars = c("citizenship2", "age"))
## extract GADSdat with specific variables
gads3 <- extractVars(gads, vars = c("ID", "citizenship1"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.