lbraglia / RStata

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

Error in seq.int(cutpoints[1] + 1, cutpoints[2] - 1)... MacOS 10.12.4, Stata 14.2, R 3.4 #9

Closed pnauroth closed 7 years ago

pnauroth commented 7 years ago

I get:

Error in seq.int(cutpoints[1] + 1, cutpoints[2] - 1) : 'from' cannot be NA, NaN or infinite

when running:

stata_src <- '
log using eval
sysuse auto
reg mpg weight
'
stata(src = stata_src)

with:

options("RStata.StataPath"="/Applications/Stata\\ 14/Stata.app/Contents/MacOS/Stata")
options("RStata.StataVersion" = 14)

Stata starts normally and runs the code without error and the log-file shows the correct output. It seems the error occurs after Stata has run all of the code.

BTW: I do not have a profile.do file that I know of.

Any help is greatly appreciated!

lbraglia commented 7 years ago

hi

are you sure you set the batch/command line executable as StataPath? (it should have a path like

/Applications/Stata/StataSE.app/Contents/MacOS/stata-se

or something similar, at least up to version 13 ...); look at the readme

pnauroth commented 7 years ago

Thanks for the quick reply! I set it executable via

sudo chmod 777 /Applications/Stata\ 14/Stata.app/Contents/MacOS/Stata

but i get the same error nonetheless.

lbraglia commented 7 years ago

I was trying to tell that you're probably setting a wrong StataPath to something that is not the batch version of Stata (not a permission problem).

can you please command this on the command line

cd /Applications/Stata\ 14/Stata.app/Contents/MacOS/ #<- fix spaces here (do use TAB)
ls -l Stata
tree Stata

and post here the results?

Furthermore can you tell me which version (IC, SE ...) do you have licensed?

thanks

pnauroth commented 7 years ago

Thanks a lot for your patience! I appreciate this a lot. Here is what I got:

Peters-MBP-2:MacOS peternauroth$ pwd
/Applications/Stata 14/Stata.app/Contents/MacOS
Peters-MBP-2:MacOS peternauroth$ ls -laH
total 46288
drwxrwxr-x  3 root  admin       102 13 Dez 16:37 .
drwxrwxr-x  8 root  admin       272 13 Dez 16:37 ..
-rwxrwxrwx  1 root  admin  23697968 13 Dez 16:37 Stata
Peters-MBP-2:MacOS peternauroth$ 
lbraglia commented 7 years ago

umm it seems that the file Stata is the only executable available in the directory.

When i tested RStata on a mac some time ago (with version 13) in the directory Applications/Stata/StataSE.app/Contents/MacOS I had several binaries. One of them was a file namedstata-se for which i had the license (Stata SE); and if executed, it was the batch/terminal version of stata (eg does not start the "graphical"/classical interface but executes it directly in the terminal used).

Which license do you have? IC? Because one guy some time ago told me that with an IC license one does not have the batch version executable which is needed by RStata.

So, it seems you set the StataPath right, but i don't know how to help.

If you find a way to make it work, i'm interested, let me know.

pnauroth commented 7 years ago

This seems to be exactly the problem. I have IC and there is no batchversion for this version: http://www.stata.com/manuals13/gsmc.pdf see C4 for MacOS. Thanks for pointing this out!

abzhaobo commented 7 years ago

Same error on MacOS 10.11.4, StataMP 14 with "stata-mp" (batch version) available. R version 3.4.0

lbraglia commented 7 years ago

@zxzb which options("RStata.StataPath") did you set?

abzhaobo commented 7 years ago

options("RStata.StataPath" = "/Applications/Stata/StataMP.app/Contents/MacOS/stata-mp") options("RStata.StataVersion" = 14)

These are the options I set. I tried click on the "stata-mp" and it is working with the terminal. Is this the batch version that should be working?

lbraglia commented 7 years ago

Yes it is. I'm sorry I don't know how to help. When i programmed the package i tested on el capitan with stata se 13 and setting parameters equivalent to yours, it worked fine..

abzhaobo commented 7 years ago

OK, then I might try an SE version as well. Anyway thanks for the great glue!