[R] exporting data to stata

Michael Dewey lists at dewey.myzen.co.uk
Thu Mar 22 13:12:02 CET 2018


Dear Rosario

Your object called data1 is, as you showed us, of the wrong class. You 
therefore need to convert it in some way although i suspect you will 
then use the survey information.

Michael.

On 22/03/2018 07:46, rosario scandurra wrote:
> Hi,
> 
> I am new to R and I want to export data into Stata. Could somebody help with that? Thanks a lot.
> 
> This is the code I am using:
> 
> 
>> setwd("D:/datasets/Seg-bcn/ESBD")
>> data1 <- readRDS("r17045_ESDB_Habitatges_BDD_V_1_0.rds")
>> library(foreign)
>> write.dta(data="data1", file = "D:/datasets/data1.dta")
> Error in write.dta(data = "data1", file = "D:/datasets/data1.dta") :
>    The object "dataframe" must have class data.frame
>> class (data1)
> [1] "survey.design2" "survey.design"
> 
> 
> 	[[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.
> 

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list