[R] Importing data with value labels into R

IAGO GINÉ VÁZQUEZ |@go@g|ne @end|ng |rom @jd@e@
Tue Nov 15 08:35:57 CET 2022


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 using r-project.org> de part de Maryam Iraniparast <miraniparast using uwaterloo.ca>
Enviat el: dilluns, 14 de novembre de 2022 19:07
Per a: r-help using r-project.org <r-help using 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 using 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]]



More information about the R-help mailing list