Last chance! 50% off unlimited learning
Sale ends in
read_spss(path, enc = NA, attach.var.labels = FALSE,
atomic.to.fac = FALSE, keep.na = FALSE, option = "haven")
option = "haven"
(default).TRUE
, variable labels will automatically be
added to each variable as "variable.label"
attribute. Use this
parameter, if option = "foreign"
, where variable labels are added
as list-attribute to the importTRUE
, user-defined missing values will be
left as their original codes. If FALSE
(default), corresponding
values are converted to NA
.option = "haven"
, which means, the read_spss
function
from the option = "foreign"
to
use forget_labels
and variable labels with get_label
.write_spss
# import SPSS data set. uses haven's read function
# by default
mydat <- read_spss("my_spss_data.sav")
# use foreign's read function
mydat <- read_spss("my_spss_data.sav",
enc = "UTF-8",
option = "foreign")
# use haven's read function, convert atomic to factor
mydat <- read_spss("my_spss_data.sav", atomic.to.fac = TRUE)
# retrieve variable labels
mydat.var <- get_label(mydat)
# retrieve value labels
mydat.val <- get_labels(mydat)
Run the code above in your browser using DataLab