extractVars {eatGADS} | R Documentation |
Extract or remove variables from a GADSdat
.
Description
Extract or remove variables and their meta data from a GADSdat
object.
Usage
extractVars(GADSdat, vars)
removeVars(GADSdat, vars)
Arguments
GADSdat |
|
vars |
A character vector containing the variables names in the |
Details
Both functions simply perform the variable removal or extraction from the underlying data.frame
in the GADSdat
object followed by calling updateMeta
.
Value
Returns a GADSdat
object.
Examples
## 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"))
[Package eatGADS version 1.1.0 Index]