read.sav | R Documentation |
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.
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)
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 |
Returns a data frame or tibble.
Hadley Wickham, Evan Miller and Danny Smith
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
read.dta
, write.dta
, read.xlsx
,
write.xlsx
, read.mplus
, write.mplus
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.