spss_import {ImportExport} | R Documentation |
Import data set from SPSS (.sav)
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
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 |
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
Examples
## Not run:
x <- spss_import("mydata.sav")
## End(Not run)