Check a set of LSD variables names against a LSD results file

Description

This function checks if all variable names in a set are valid for a LSD results file (.res). If no name is provided, the function returns all the valid unique variable names in the file.

Usage

1
name.check.lsd(file, col.names = NULL, check.names = TRUE)

Arguments

file

the name of the LSD results file which the data are to be read from. If it does not contain an absolute path, the file name is relative to the current working directory, getwd(). This can be a compressed file (see file) and must include the appropriated extension (usually .res or .res.gz).

col.names

a vector of optional names for the variables. The default is to read all (unique) variables.

check.names

logical. If TRUE then the names of the variables are checked to ensure that they are syntactically valid variable names. If necessary they are adjusted (by make.names) so that they are, and also to ensure that there are no duplicates.

Value

Returns a character vector containing the valid variable names contained in the results file.

Author(s)

Marcelo C. Pereira

See Also

info.names.lsd,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Save current work directory and change to the examples directory
currWD <- getwd()
setwd(system.file("extdata", package = "LSDinterface"))

name.check.lsd("Sim1_1.res")

name.check.lsd("Sim1_1.res", col.names = c("GDP", "_growth1"))

# Restore working directory
setwd(currWD)