Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

read.obs

Importing original data sets form external files


Description

Imports data data sets form external files into a data frame. Currently supported files include: sav (SPSS), dta (Stata), xpt (SAS), csv (comma-separated file), tab (tab-delimited file) and txt (delimited text files). For SPSS, Stata and SAS it uses functions from the foreign package with some adjustments where necessary.

Usage

read.obs(file, convert.factors = TRUE, lab.factors = FALSE, 
export.lab = FALSE, ...)

Arguments

file

the name of the file (including extension) which the data are to be read from.

convert.factors

a logical value indicating whether variables with value labels in Stata and SPSS should be converted into R factors with those levels.

lab.factors

a logical value indicating whether variables with complete value labels but imported using their numeric codes (convert.factors = FALSE) should be converted from numeric to factor variables.

export.lab

a logical variable indicating whether labels from SPSS or Stata should be exported to an external file.

...

additional parameters passed to read functions.

Value

A data frame with an imported data set. For SPSS, Stata and SAS it has attributes with labels.

See Also


synthpop

Generating Synthetic Versions of Sensitive Microdata for Statistical Disclosure Control

v1.6-0
GPL-2 | GPL-3
Authors
Beata Nowok [aut, cre], Gillian M Raab [aut], Chris Dibben [ctb], Joshua Snoke [ctb], Caspar van Lissa [ctb]
Initial release
2020-09-03

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.