name.r.unique.lsd: Get valid unique R variable name

View source: R/vars.R

name.r.unique.lsdR Documentation

Get valid unique R variable name

Description

This function produces a valid and unique variable name from names produced from multi-instanced LSD variables (as in read.raw.lsd).

Usage

name.r.unique.lsd( r.name )

Arguments

r.name

a string, a vector of strings, or an object which can be coerced to a character vector by as.character, from the column names produced by reading a LSD results file.

Details

The function removes the trailing '.' characters, and the text between, introduced during the conversion from LSD results files, add an 'X' prefix to names started by an '_'. After this initial transformation, all repeated variable names (originated from multi-instanced variables) are removed.

The produced names are R valid variable names, similar to the original LSD/C++ variable names, but with an 'X' prepended to variables starting with an '_' (which are invalid in R).

Value

A string or a string vector of converted string(s) including only non-repeated ones.

Author(s)

Marcelo C. Pereira

See Also

name.var.lsd(), name.clean.lsd(), name.nice.lsd(), info.names.lsd()

Examples

name.r.unique.lsd( "Var1.1_1.1_100" )

name.r.unique.lsd( c( "Var1.1_1.1_100", "_Var2.1_1.1_100", "_Var2.1_2.50_70" ) )

LSDinterface documentation built on May 14, 2022, 1:05 a.m.