View source: R/check_varnames.R
check_varnames | R Documentation |
This function is used to check the consistency of variable names for the new yearly data. Checks will be run against the expected variable names (e.g. based on the previous year's variable names), and any inconsistencies will be returned.
check_varnames(data, old_names = NULL)
data |
The data frame containing the new year of (combined) data, with the variable names stored in |
old_names |
A vector of strings indicating the old (or expected) variable names in the data set.
The default is a vector of variable names coming from the 2016-2017 combined data, stored as an
Rdata file in the package, called |
A list containing Is_same
, Omitted
, and Extra
. Is_same
is boolean-valued,
indicating whether or not the new variable names were consistent with the expected variable names. Omitted
is a vector of strings corresponding to the variables from old_names
not appearing in data
.
Extra
is a vector of strings corresponding to the variables in data
not appearing in old_names
.
old_names <- letters[1:3]
data <- as.data.frame(matrix(rnorm(12),3,4))
colnames(data) <- c("a","B","c","x")
check_varnames(old_names, data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.