Hello Maryam,
The haven function for reading Stata files is read_dta (not read.dta!!!). May
this be your issue?
Iago
________________________________
De: R-help <r-help-bounces at r-project.org> de part de Maryam Iraniparast
<miraniparast at uwaterloo.ca>
Enviat el: dilluns, 14 de novembre de 2022 19:07
Per a: r-help at r-project.org <r-help at r-project.org>
Tema: [R] Importing data with value labels into R
Hello!
I want to read SPSS data into R and I want to carry the value labels with my
dataset.
Based on my research, only Stata file can transfer the value labels to R (It is
easy to save SPSS data with Stata format).
The last time I did that successfully, I was using R4.2.1 and the following
code. But it does not work anymore.
install.packages("tidyverse")
install.packages("haven")
library(tidyverse)
library(haven)
df=file.choose() *Note: Select the STATA file from the folder where it is saved.
dataset=read.dta(df)
I appreciate any thoughts or suggestion.
Thanks,
Mary
[[alternative HTML version deleted]]
______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]