Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
eivindhammers opened this issue Jan 16, 2017 · 7 comments

Comments

@eivindhammers
Copy link

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.

@lbraglia
Copy link
Owner

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

@lbraglia
Copy link
Owner

could you post

options("RStata.StataPath")

too?

@eivindhammers
Copy link
Author

StataSE,

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

@lbraglia
Copy link
Owner

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

@eivindhammers
Copy link
Author

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.

@lbraglia
Copy link
Owner

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

@realrbird
Copy link

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants