Learn R Programming

eatGADS (version 1.1.1)

checkVarNames: Check names for SQLite column name conventions.

Description

Checks names for SQLite column name conventions and applies appropriate variable name changes to GADSdat or all_GADSdat objects.

Usage

checkVarNames(GADSdat, checkKeywords = TRUE, checkDots = TRUE)

Value

Returns the original object with updated variable names.

Arguments

GADSdat

GADSdat or all_GADSdat object.

checkKeywords

Logical. Should SQLite keywords be checked and modified?

checkDots

Logical. Should occurrences of "." be checked and modified?

Details

Invalid column names in a SQLite data base include

  • SQLite keywords (see sqlite_keywords) and

  • column names with a "." in it.

The corresponding variable name changes are

  • appending the suffix "Var" to all SQLite keywords and

  • changing all "." in variable names to "_".

Note that avoiding "." in variable names is beneficial for multiple reasons, such as avoiding confusion with S3 methods in R and issues when importing from Stata.

Examples

Run this code
# Change example data set (create an invalid variable name)
pisa2 <- changeVarNames(pisa, oldNames = "computer_age",
                        newNames = "computer.age")

pisa3 <- checkVarNames(pisa2)

Run the code above in your browser using DataLab