lbraglia / RStata

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

Error in seq.int(cutpoints[1] + 1, cutpoints[2] - 1) : Stata 15.1, Windows 10 #12

Closed subodh-kumar11 closed 4 years ago

subodh-kumar11 commented 6 years ago

R version: 3.5.0 - (64 bit) RStudio version: 1.1.463 - (64 bit) Rstata package version: 1.1.1 Stata version: 15.1 OS: Windows 10

I have tried debug steps mentioned at below url: https://github.com/lbraglia/RStata/issues/6

In above url, @lbraglia mentioned, problem is with below line: cutpoints <- grep(cut_me_here, stataLog)

When I checked output of "cutpoints" in debug mode, it is 29.

Even I agree with it, since very next line in stata is: stataLog <- stataLog[seq.int(cutpoints[1] + 1, cutpoints[2] - 1)]

Since, cutpoints[1] contains value 29, but cutpoints[2] is equal to NA, in that way above method is like: seq.int(29+1,NA-1) = seq.int(30,NA) Thats why error is throwing as: Warning: Error in seq.int: 'to' must be a finite number

Below screenshot is supporting debugging steps and outcomes: image

I hope will get quick help.

Thanks.

subodh-kumar11 commented 5 years ago

Hi Team,

My stata program, "sample.do", is able to generate output as per requirement, but at last because of "cutpoints" containing NA, is throwing warning error. Thats why my shiny dashboard get disconnected from the localhost server.

Please help me on it.

Thanks, Subodh Kumar

lbraglia commented 5 years ago

can you post the variable stataLog just before evaluating

stataLog <- stataLog[seq.int(cutpoints[1] + 1, cutpoints[2] - 1)]