spss_import: Import data set from SPSS (.sav)

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/spss_import.R

Description

Read a labelled data set from SPSS, finding automatically the date variables and keeping the variable and value labels information, by using the information obtained with spss_varlist() and the function spss.get from the Hmisc Package.

Usage

1
spss_import(file, allow="_",out.format="d-m-yy",use.value.labels=F,...)

Arguments

file

The path to the file with .sav extension.

allow

A vector which contains the characters that must be allowed in the variable names.

out.format

A character specifying the format for printing the date variables.

use.value.labels

If TRUE, replace the labelled variables with their value labels.

...

See spss.get.

Details

In order to provide the maximum functionallity, if the main code generates an error, the function tries to read the file with the read_sav function from the haven package, but a warning message appears. The var_view function can be used to summarize the contents of the data frame labels.

Value

A data frame or a list containing the data stored in the SPSS file.

Note

If the warning message appears and the file has been read using read_sav the resulting data frame will be diferent from the expected one (see the haven package to learn more about read_sav).

Author(s)

Dave MacFarlane, Roger Pros, Isaac Subirana

See Also

var_view, spss.get, read_sav

Examples

1
2
3
4
5
## Not run: 
x <- spss_import("mydata.sav")


## End(Not run)

ImportExport documentation built on Jan. 13, 2021, 7:39 a.m.