lbraglia/RStata

Error in seq.int(cutpoints[1] + 1, cutpoints[2] - 1) : Stata 14.1, Windows 7

eivindhammers opened this issue · 7 comments

Running Rstata in R 3.3.2, from RStudio 0.99.902 against Stata 14.1 on Windows 7 I get an error. I've set up Rstata using chooseStataBin(), and set options("RStata.StataVersion" = 14).

I run:

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

I get:

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

When switching to stata.echo = FALSE I get no error.

which Stata license? (eg SE, IC ...)

could you post

options("RStata.StataPath")

too?

StataSE,

> options("RStata.StataPath")
$RStata.StataPath
[1] "\"C:\\Program Files (x86)\\Stata14\\StataSE-64\""

I'm not able to reproduce your issue on Win 7, stata 13

> chooseStataBin()
[1] "\"C:\\Program Files (x86)\\Stata13\\StataSE-64\""
> options("RStata.StataVersion" = 13)
> x <- data.frame(a = rnorm(3), b = letters[1:3])
> stata( "sum a", data.in = x)
. sum a

    Variable |       Obs        Mean    Std. Dev.       Min        Max
-------------+--------------------------------------------------------
           a |         3    -.921967    .4627757  -1.430603  -.5257751

the error is due to the fact that there should be problems with this line of stata in your setup

cutpoints <- grep(cut_me_here, stataLog)

Could you please use debug(stata) and step until the line above, then print the content of the variable

stataLog

Furthermore, at that point of debug, please tell me if in getwd() you have a file called RStata.do and RStata.log

Thanks for the hints. I examined my StataLog, and it showed an not found error on execution of RStata.do. The problem occurred because I cd to my "C:/Users/USER" directory in profile.do, and RStata.do is obviously not found in that directory.

Problem fixed by commenting out cd "C:/Users/USER" in profile.do.

ok thanks for your debugging. I added a note to the troubleshooting section of README.md

I am getting this problem with Stata 15. I do not a profile.do specified, do I need to create an empty one? Below is the error. I am using the most recent development version and am on Mac. Any help is appreciated, thanks in advance.

library(RStata)
chooseStataBin()
[1] ""
options("RStata.StataPath" = "/Applications/Stata/StataIC.app/Contents/MacOS/StataIC")
options("RStata.StataVersion" = 15)
stata('help regress')
Error in seq.int(cutpoints[1] + 1, cutpoints[2] - 1) :
'from' must be a finite number
options('RStata.StataVersion')
$RStata.StataVersion
[1] 15

options('RStata.StataPath')
$RStata.StataPath
[1] "/Applications/Stata/StataIC.app/Contents/MacOS/StataIC"