read.sav {misty} | R Documentation |
Read SPSS File
Description
This function calls the read_spss
function in the haven package
by Hadley Wickham, Evan Miller and Danny Smith (2023) to read an SPSS file.
Usage
read.sav(file, use.value.labels = FALSE, use.missings = TRUE, formats = FALSE,
label = FALSE, labels = FALSE, missing = FALSE, widths = FALSE,
as.data.frame = TRUE, check = TRUE)
Arguments
file |
a character string indicating the name of the SPSS data file
with or without file extension '.sav', e.g., |
use.value.labels |
logical: if |
use.missings |
logical: if |
formats |
logical: if |
label |
logical: if |
labels |
logical: if |
missing |
logical: if |
widths |
logical: if |
as.data.frame |
logical: if |
check |
logical: if |
Value
Returns a data frame or tibble.
Author(s)
Hadley Wickham, Evan Miller and Danny Smith
References
Wickham H, Miller E, Smith D (2023). haven: Import and Export 'SPSS', 'Stata' and 'SAS' Files. R package version 2.5.3. https://CRAN.R-project.org/package=haven
See Also
read.dta
, write.dta
, read.xlsx
,
write.xlsx
, read.mplus
, write.mplus
Examples
## Not run:
# Example 1: Read SPSS data file
read.sav("SPSS_Data.sav")
read.sav("SPSS_Data")
# Example 2: Read SPSS data file, convert variables with value labels into factors
read.sav("SPSS_Data.sav", use.value.labels = TRUE)
# Example 3: Read SPSS data file, user-defined missing values are not converted into NAs
read.sav("SPSS_Data.sav", use.missing = FALSE)
# Example 4: Read SPSS data file as tibble
read.sav("SPSS_Data.sav", as.data.frame = FALSE)
## End(Not run)