read_spss | R Documentation |
This is a wrapper around haven::read_spss
with some exception handling.
read_spss(
file,
user_na = TRUE,
dataset_bibentry = NULL,
id = NULL,
doi = NULL,
.name_repair = "unique"
)
file |
An SPSS file. |
user_na |
Should user-defined na_values be imported? Defaults
to |
dataset_bibentry |
A bibliographic entry created with
|
id |
An identifier of the tibble, if omitted, defaults to the file name without its extension. |
doi |
An optional document object identifier. |
.name_repair |
Defaults to |
'read_sav()' reads both '.sav' and '.zsav' files; 'write_sav()' creates '.zsav' files when 'compress = TRUE'. 'read_por()' reads '.por' files. 'read_spss()' uses either 'read_por()' or 'read_sav()' based on the file extension.
When the SPSS file has columns which are of class labelled, but have no labels, they are read as numeric or character vectors.
A tibble:
Variable labels are stored in the "label" attribute of each variable. It is not printed on the console, but the RStudio viewer will show it.
'write_sav()' returns the input 'data' invisibly.
Other import functions:
pull_survey()
,
read_csv()
,
read_dta()
,
read_rds()
,
read_surveys()
path <- system.file("examples", "iris.sav", package = "haven")
haven::read_sav(path)
tmp <- tempfile(fileext = ".sav")
haven::write_sav(mtcars, tmp)
haven::read_sav(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.