0

In R-studio the processing always stops at the error, if there any way to have this behavior in StatET/Eclipse?

Details:

When using R in Eclipse through StatET, if I run a command such as

x = 7
x = xx + x
x

via "Run Selection in R" (Ctrl + R, Ctrl + R) I get the output

> x = 7
> x = xx + x
Error: object 'xx' not found
> x
[1] 7

In this contrived example there isn't much of a problem, but with many lines of code its easy that the error message gets lost among many pages of output and that the wrong value is ultimately used in the rest of the calculations.

I've tried putting the whole thing curly braces works but this somewhat defeats the speed of having a dedicated command to run the selection. I've also tried options(error = NULL) as per this post but it doesn't fix the problem.

Many thanks.

Community
  • 1
  • 1
c z
  • 7,726
  • 3
  • 46
  • 59

1 Answers1

-1

This problem is a result of options(error = NULL). Remove that and you will get the intended behaviour.

BTW, you should use <- for assignments.

lith
  • 929
  • 8
  • 23
  • Where in Eclipse can this be found/how can this be done? – Single Entity Apr 22 '15 at 14:12
  • 1
    @SingleEntity This cannot be done in eclipse but in R. The options can be set anywhere you want. For commonly used options, .Rprofile is a good place. In StatET there is a field for run configurations that let you run R code on startup. – lith Apr 26 '15 at 18:21
  • In the Rprofile there is no error option to remove, do I need to set the option to something else to allow the code to terminate on a stop command? Thanks – Single Entity Apr 29 '15 at 13:19
  • That works in R from the console (and only for a single statement submitted at once), but StatET submits each line at a time, meaning this doesn't work. – c z Aug 10 '15 at 10:50
  • @c-z I see. I don't think this is the fault of StatET though. If you paste the code into the R console you get exactly the same behaviour. The user should probably wrap things up in a function or put the code into a file and use source() to evaluate that file. – lith Aug 11 '15 at 11:29