Using R on LISSY

This page explains the special methods used to load LIS and LWS data in R and generate output, and documents the add-on packages currently available on the system.

Loading Data

Data is read into the workspace using the read.LIS function, which has one required argument and three optional arguments. It works as follows:

Usage

read.LIS(ccyyuu, labels=TRUE, vars=NULL, subset=NULL)

 

Arguments

ccyyuu A string or vector of strings containing dataset identifiers, indicating which datasets to load. For the formatting of this identifier, see Details.
labels A logical value indicating whether to use the value labels for categorical variables. If TRUE, creates a factor from the labels. If FALSE, uses the numeric codes.
subset An optional string specifying a subset of observations to be return. By default, all observations are returned.
vars An optional vector of variables to be loaded. By default, all variables are returned.

Details

The format of ccyyuu is a country and year code followed by a one-letter code used to identify the specific type of dataset within each database:

LIS dataset ‘h’ or ‘p’ for household or person file e.g. “lu04h”, “us10p”
LWS dataset ‘h’, ‘p’ or ‘r’ for household, person or implicate file e.g. “ca05h”, “us10p” or “us10r”

If a vector of multiple dataset identifiers is provided, the datasets will be concatenated and returned as a single “stacked” data frame. Attempting to simultaneously retrieve two datasets containing different variables (e.g., a household and a person file) will cause an error, because such incompatible datasets cannot be stacked on top of one another.

See Examples for code that retrieves the household and person files separately and then generates a merged file, with household data appended to individual records.

When labels is set to FALSE, the value labels will still be stored in the attributes of the data frame, in the named list attribute “label.table”.

Value

A data frame with attributes. See the documentation for read.dta13 for more information.

Examples

# Load the household file for Luxembourg 2010
ds <- read.LIS('lu10h')

# Load the person file for Luxembourg 2010, numeric codes only
ds <- read.LIS('lu10p', labels=FALSE)
print(table(ds$educ))
print(attributes(ds)$label.table$educ)

# Load a combined dataset for Luxembourg 2004 and 2010, containing 
only the dataset name, weights, and disposable household income, for 
households containing children under age 18.
ds <- read.LIS(c('lu04h','lu10h'), 
vars=c('dname','hwgt','dhi'), 
subset="nhhmem17>0")

# Load and merge the household and person files for Luxembourg 2010
dsh <- read.LIS('lu10h')
dsp <- read.LIS('lu10p')
ds <- merge(dsp, dsh, by="hid")

Producing Output

Because of LIS security procedures, you may need to make small modifications to your code in order to produce output. In order to ensure that it will appear in the log file, you must explicitly print() an object, for example:

print(table(x))

In addition, the printing of objects of class data.frame has been disabled.

Add-on packages

The R installation on LISSY includes all the packages that are included in base R, as well as all the recommended packages. In addition, the packages listed below are available and can be loaded using functions such as

library()

or

require()

If you would like to request a package that is not currently installed, please inform User Support and we will consider it for inclusion in a future system update.

Package Version Title
abind 1.4-5 Combine Multidimensional Arrays
acepack 1.4.1 ACE and AVAS for Selecting Multiple Regression Transformations
arm 1.10-1 Data Analysis Using Regression and Multilevel/Hierarchical Models
assertthat 0.2.0 Easy Pre and Post Assertions
backports 1.1.3 Reimplementations of Functions Introduced Since R-3.0.0
base64enc 0.1-3 Tools for base64 encoding
bayesplot 1.6.0 Plotting for Bayesian Models
BH 1.69.0-1 Boost C++ Header Files
bibtex 0.4.2 Bibtex Parser
bindr 0.1.1 Parametrized Active Bindings
bindrcpp 0.2.2 An 'Rcpp' Interface to Active Bindings
blme 1.0-4 Bayesian Linear Mixed-Effects Models
broom 0.5.1 Convert Statistical Analysis Objects into Tidy Tibbles
carData 3.0-2 Companion to Applied Regression Data Sets
caret 6.0-81 Classification and Regression Training
checkmate 1.9.1 Fast and Versatile Argument Checks
cli 1.1.0 Helpers for Developing Command Line Interfaces
clipr 0.5.0 Read and Write from the System Clipboard
coda 0.19-2 Output Analysis and Diagnostics for MCMC
coin 1.3-0 Conditional Inference Procedures in a Permutation Test Framework
colorspace 1.4-1 A Toolbox for Manipulating and Assessing Colors and Palettes
contfrac 1.1-12 Continued Fractions
crayon 1.3.4 Colored Terminal Output
crosstalk 1.0.0 Inter-Widget Interactivity for HTML Widgets
cubature 2.0.3 Adaptive Multivariate Integration over Hypercubes
CVST 0.2-2 Fast Cross-Validation via Sequential Testing
data.table 1.12.0 Extension of `data.frame`
DEoptimR 1.0-8 Differential Evolution Optimization in Pure R
deSolve 1.21 Solvers for Initial Value Problems of Differential Equations ('ODE', 'DAE', 'DDE')
digest 0.6.18 Create Compact Hash Digests of R Objects
dplyr 0.8.0.1 A Grammar of Data Manipulation
DT 0.5 A Wrapper of the JavaScript Library 'DataTables'
ellipsis 0.1.0 Tools for Working with ...
elliptic 1.4-0 Weierstrass and Jacobi Elliptic Functions
emmeans 1.3.3 Estimated Marginal Means, aka Least-Squares Means
estimability 1.3 Tools for Assessing Estimability of Linear Predictions
evaluate 0.13 Parsing and Evaluation Tools that Provide More Details than the Default
fansi 0.4.0 ANSI Control Sequence Aware String Functions
fastDummies 1.2.0 Fast Creation of Dummy (Binary) Columns and Rows from Categorical Variables
fit.models 0.5-14 Compare Fitted Models
forcats 0.4.0 Tools for Working with Categorical Variables (Factors)
foreach 1.4.4 Provides Foreach Looping Construct for R
Formula 1.2-3 Extended Model Formulas
GB2 2.1 Generalized Beta Distribution of the Second Kind: Properties, Likelihood, Estimation
gbRd 0.4-11 Utilities for processing Rd objects and files
gdata 2.18.0 Various R Programming Tools for Data Manipulation
gee 4.13-19 Generalized Estimation Equation Solver
generics 0.0.2 Common S3 Generics not Provided by Base R Methods Related to Model Fitting
ggeffects 0.9.0 Create Tidy Data Frames of Marginal Effects for 'ggplot' from Model Outputs
ggplot2 3.1.0 Create Elegant Data Visualisations Using the Grammar of Graphics
ggridges 0.5.1 Ridgeline Plots in 'ggplot2'
ggthemes 4.1.0 Extra Themes, Scales and Geoms for 'ggplot2'
glmmTMB 0.2.3 Generalized Linear Mixed Models using Template Model Builder
glue 1.3.1 Interpreted String Literals
gmm 1.6-2 Generalized Method of Moments and Generalized Empirical Likelihood
gmodels 2.18.1 Various R Programming Tools for Model Fitting
gower 0.2.0 Gower's Distance
gridExtra 2.3 Miscellaneous Functions for Grid Graphics
gtable 0.2.0 Arrange 'Grobs' in Tables
gtools 3.8.1 Various R Programming Tools
haven 2.1.0 Import and Export 'SPSS', 'Stata' and 'SAS' Files
highr 0.7 Syntax Highlighting for R Source Code
Hmisc 4.2-0 Harrell Miscellaneous
hms 0.4.2 Pretty Time of Day
htmlTable 1.13.1 Advanced Tables for Markdown/HTML
htmltools 0.3.6 Tools for HTML
htmlwidgets 1.3 HTML Widgets for R
httpuv 1.5.0 HTTP and WebSocket Server Library
huxtable 4.5.0 Easily Create and Style Tables for LaTeX, HTML and Other Formats
hypergeo 1.2-13 The Gauss Hypergeometric Function
IC2 1.0-1 Inequality and Concentration Indices and Curves
ineq 0.2-13 Measuring Inequality, Concentration, and Poverty
insight 0.1.2 Easy Access to Model Information for Various Model Objects
ipred 0.9-8 Improved Predictors
iterators 1.0.10 Provides Iterator Construct for R
janitor 1.1.1 Simple Tools for Examining and Cleaning Dirty Data
jsonlite 1.6 A Robust, High Performance JSON Parser and Generator for R
kernlab 0.9-27 Kernel-Based Machine Learning Lab
knitr 1.22 A General-Purpose Package for Dynamic Report Generation in R
labeling 0.3 Axis Labeling
laeken 0.5.0 Estimation of Indicators on Social Exclusion and Poverty
later 0.8.0 Utilities for Delaying Function Execution
latticeExtra 0.6-28 Extra Graphical Utilities Based on Lattice
lava 1.6.5 Latent Variable Models
lavaan 0.6-3 Latent Variable Analysis
lazyeval 0.2.2 Lazy (Non-Standard) Evaluation
libcoin 1.0-4 Linear Test Statistics for Permutation Inference
lme4 1.1-21 Linear Mixed-Effects Models using 'Eigen' and S4
lmtest 0.9-36 Testing Linear Regression Models
lubridate 1.7.4 Make Dealing with Dates a Little Easier
magrittr 1.5 A Forward-Pipe Operator for R
markdown 0.9 'Markdown' Rendering for R
Matching 4.9-5 Multivariate and Propensity Score Matching with Balance Optimization
MatchIt 3.0.2 Nonparametric Preprocessing for Parametric Causal Inference
matrixcalc 1.0-3 Collection of functions for matrix calculations
MatrixModels 0.4-1 Modelling with Sparse And Dense Matrices
matrixStats 0.54.0 Functions that Apply to Rows and Columns of Matrices (and to Vectors)
maxLik 1.3-4 Maximum Likelihood Estimation and Related Tools
memoise 1.1.0 Memoisation of Functions
merTools 0.4.1 Tools for Analyzing Mixed Effect Regression Models
mi 1.0 Missing Data Imputation and Model Checking
mime 0.6 Map Filenames to MIME Types
minpack.lm 1.2-1 R Interface to the Levenberg-Marquardt Nonlinear Least-Squares Algorithm Found in MINPACK, Plus Support for Bounds
minqa 1.2.4 Derivative-free optimization algorithms by quadratic approximation
miscTools 0.6-22 Miscellaneous Tools and Utilities
mlogit 0.4-1 Multinomial Logit Models
mnormt 1.5-5 The Multivariate Normal and t Distributions
ModelMetrics 1.2.2 Rapid Calculation of Model Metrics
modelr 0.1.4 Modelling Functions that Work with the Pipe
modeltools 0.2-22 Tools and Classes for Statistical Models
multcomp 1.4-10 Simultaneous Inference in General Parametric Models
munsell 0.5.0 Utilities for Using Munsell Colours
mvtnorm 1.0-10 Multivariate Normal and t Distributions
nleqslv 3.3.2 Solve Systems of Nonlinear Equations
nloptr 1.2.1 R Interface to NLopt
numDeriv 2016.8-1 Accurate Numerical Derivatives
optimx 2018-7.10 Expanded Replacement and Extension of the 'optim' Function
pbivnorm 0.6.0 Vectorized Bivariate Normal CDF
pcaPP 1.9-73 Robust PCA by Projection Pursuit
pillar 1.3.1 Coloured Formatting for Columns
pkgconfig 2.0.2 Private Configuration for 'R' Packages
plogr 0.2.0 The 'plog' C++ Logging Library
plyr 1.8.4 Tools for Splitting, Applying and Combining Data
poLCA 1.4.1 Polytomous variable Latent Class Analysis
prediction 0.3.6.2 Tidy, Type-Safe 'prediction()' Methods
prodlim 2018.04.18 Product-Limit Estimation for Censored Event History Analysis
promises 1.0.1 Abstractions for Promise-Based Asynchronous Programming
psych 1.8.12 Procedures for Psychological, Psychometric, and Personality Research
purrr 0.3.2 Functional Programming Tools
pwr 1.2-2 Basic Functions for Power Analysis
quantreg 5.38 Quantile Regression
R6 2.4.0 Encapsulated Classes with Reference Semantics
RColorBrewer 1.1-2 ColorBrewer Palettes
Rcpp 1.0.1 Seamless R and C++ Integration
RcppEigen 0.3.3.5.0 'Rcpp' Integration for the 'Eigen' Templated Linear Algebra Library
RcppRoll 0.3.0 Efficient Rolling / Windowed Operations
Rdpack 0.10-1 Update and Manipulate Rd Documentation Objects
readr 1.3.1 Read Rectangular Text Data
readstata13 0.9.2 Import 'Stata' Data Files
recipes 0.1.4 Preprocessing Tools to Create Design Matrices
reshape2 1.4.3 Flexibly Reshape Data: A Reboot of the Reshape Package
rgenoud 5.8-3.0 R Version of GENetic Optimization Using Derivatives
rlang 0.3.1 Functions for Base Types and Core R and 'Tidyverse' Features
robust 0.4-18 Port of the S+ Robust Library
robustbase 0.93-4 Basic Robust Statistics
rrcov 1.4-7 Scalable Robust Estimators with High Breakdown Point
rstudioapi 0.9.0 Safely Access the RStudio API
sandwich 2.5-0 Robust Covariance Matrix Estimators
scales 1.0.0 Scale Functions for Visualization
scatterplot3d 0.3-41 3D Scatter Plot
sem 3.1-9 Structural Equation Models
sjlabelled 1.0.17 Labelled Data Utility Functions
sjmisc 2.7.9 Data and Variable Transformation Functions
sjPlot 2.6.2 Data Visualization for Statistics in Social Science
sjstats 0.17.4 Collection of Convenient Functions for Common Statistical Computations
snakecase 0.9.2 Convert Strings into any Case
sourcetools 0.1.7 Tools for Reading, Tokenizing and Parsing R Code
SparseM 1.77 Sparse Linear Algebra
SQUAREM 2017.10-1 Squared Extrapolation Methods for Accelerating EM-Like Monotone Algorithms
stargazer 5.2.2 Well-Formatted Regression and Summary Statistics Tables
statmod 1.4.30 Statistical Modeling
stringdist 0.9.5.1 Approximate String Matching and String Distance Functions
stringi 1.4.3 Character String Processing Facilities
stringr 1.4.0 Simple, Consistent Wrappers for Common String Operations
survey 3.35-1 Analysis of Complex Survey Samples
TH.data 1.0-10 TH's Data Archive
tibble 2.1.1 Simple Data Frames
tidyr 0.8.3 Easily Tidy Data with 'spread()' and 'gather()' Functions
tidyselect 0.2.5 Select from a Set of Strings
timeDate 3043.102 Rmetrics - Chronological and Calendar Objects
TMB 1.7.15 Template Model Builder: A General Random Effect Tool Inspired by 'ADMB'
utf8 1.1.4 Unicode Text Processing
viridis 0.5.1 Default Color Maps from 'matplotlib'
viridisLite 0.3.0 Default Color Maps from 'matplotlib' (Lite Version)
withr 2.1.2 Run Code 'With' Temporarily Modified Global State
xfun 0.5 Miscellaneous Functions by 'Yihui Xie'
xtable 1.8-3 Export Tables to LaTeX or HTML
yaml 2.2.0 Methods to Convert R Data to YAML and Back
zoo 1.8-4 S3 Infrastructure for Regular and Irregular Time Series (Z's Ordered Observations)