name.check.lsd: Check a set of LSD variables names against a LSD results file

View source: R/vars.R

name.check.lsdR Documentation

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

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) variable names.

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 to ensure that there are no duplicates.

Value

Returns a string vector containing the (original) valid variable names contained in the results file, using LSD/C++ naming conventions.

Author(s)

Marcelo C. Pereira

See Also

list.files.lsd() info.names.lsd(),

Examples

# get the list of file names of example LSD results
files <- list.files.lsd( system.file( "extdata", package = "LSDinterface" ) )

# check all variable names
name.check.lsd( files[ 1 ] )

# check just two names
name.check.lsd( files[ 2 ], col.names = c( "GDP", "_growth1" ) )

LSDinterface documentation built on Sept. 11, 2024, 8:22 p.m.