read_spss: Read SPSS ('.sav', '.zsav', '.por') files. Write '.sav' and...

Description Usage Arguments Details Value See Also Examples

View source: R/read_spss.R

Description

'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.

Usage

1
2
3
4
5
6
7
8
read_spss(
  file,
  user_na = TRUE,
  id = NULL,
  filename = NULL,
  doi = NULL,
  .name_repair = "unique"
)

Arguments

file

An SPSS file.

user_na

Should user-defined na_values be imported? Defaults to TRUE.

id

An identifier of the tibble, if omitted, defaults to the file name.

filename

An import file name.

doi

An optional document object identifier.

.name_repair

Defaults to "unique" See tibble::as_tibble for details.

Details

This is a wrapper around haven::read_spss

Value

A tibble, data frame variant with nice defaults.

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.

See Also

Other import functions: pull_survey(), read_rds(), read_surveys(), subset_save_surveys()

Examples

1
2
3
4
5
6
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)

antaldaniel/retroharmonize documentation built on Aug. 15, 2020, 10:13 a.m.