lbraglia / RStata

[R package]: A R-Stata interface
110 stars 37 forks source link

Adding support for haven #23

Open eveyp opened 2 years ago

eveyp commented 2 years ago

Adds support for haven when Stata version 8 and greater is used. Leave foreign in place for older versions of Stata.

Closes #14

yanyuteng commented 2 years ago

Hello eveyp, I copied from your repositoriy to read data from Stata version 15. And I first used the simple example to test it. The test codes are shown below:

x <- data.frame(a = rnorm(3), b = letters[1:3]) stata("sum a", data.in = x)

But the computation processing time is too long, and I finally interrupted it. The errors are shown below:

Error in seq.int(cutpoints[1] + 1, cutpoints[2] - 1) :    'from' must be a finite number

Besides, my environment is OSX M1, Stata 16. And when I used lbraglia's origin repository, those codes were working. 

eveyp commented 2 years ago

Hey there, thanks for the reproducible example!

I have replicated this but it occurs in both my version and the main version. It looks like this is related to #19 and #25 so I think it's an issue with the main RStata code.

josephhnath commented 1 year ago

Hey there, thanks for the reproducible example!

I have replicated this but it occurs in both my version and the main version. It looks like this is related to #19 and #25 so I think it's an issue with the main RStata code.

I'm not sure if you're still working on this, but I was able to get things running on my computer by modifying the stata.R file to include Haven code wherever there is Foreign code, particularly for the data in/out steps.