R: Read unique variable names from a LSD results file (no...
info.names.lsd
R Documentation
Read unique variable names from a LSD results file (no duplicates)
Description
This function reads the variable names (columns) from a LSD results file (.res). The names returned are converted to the original LSD names whenever possible and duplicates are removed.
Usage
info.names.lsd(file)
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(). Tilde-expansion is performed where supported. This can be a compressed file (see file) and must include the appropriated extension (usually .res or .res.gz).
Value
Returns a character vector containing the names of all unique variables contained in the selected results file.
Note
Not all names can be automatically reconverted to the original LSD names. The conversion may be incorrect if the original LSD variable is named in the format "X_...".
# Save current work directory and change to the examples directory
currWD <- getwd()
setwd(system.file("extdata", package = "LSDinterface"))
info.names.lsd("Sim1_1.res")
info.names.lsd("Sim1_2.res.gz")
# Restore working directory
setwd(currWD)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(LSDinterface)
Loading required package: abind
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LSDinterface/info.names.lsd.Rd_%03d_medium.png", width=480, height=480)
> ### Name: info.names.lsd
> ### Title: Read unique variable names from a LSD results file (no
> ### duplicates)
> ### Aliases: info.names.lsd
> ### Keywords: ~kwd1 ~kwd2
>
> ### ** Examples
>
> # Save current work directory and change to the examples directory
> currWD <- getwd()
> setwd(system.file("extdata", package = "LSDinterface"))
>
> info.names.lsd("Sim1_1.res")
[1] "GDP" "Creal" "Ir" "Am" "G" "Def" "Deb"
[8] "_A1p" "_growth1"
>
> info.names.lsd("Sim1_2.res.gz")
[1] "GDP" "Creal" "Ir" "Am" "G" "Def" "Deb"
[8] "_A1p" "_growth1"
>
> # Restore working directory
> setwd(currWD)
>
>
>
>
>
> dev.off()
null device
1
>