Expressive error messages in RStudio

I'm reading a tutorial on tidyeval. In the tutorial error messages are more expressive, showing "what" went wrong in the evaluation.

E.g.

> temp <- MASS
#> Error in eval(expr, envir, enclos): object 'MASS' not found

vs.

> temp <- MASS
#> Error: object 'MASS' not found

Is this an option I need to turn on in RStudio, or is there a package for error messages?

The error messages come from the packages. What's happening there (I believe) is that because of the way RMarkdown works, the rendering process has to explicitly call eval() around the code, which gives you a slightly different output.

I actually can't reprex what happens interactively, since reprex uses rmarkdown::render() under the hood. So, in reprex you get the same error message regardless of whether or not you explicitly call eval():

eval(temp <- MASS)
#> Error in eval(temp <- MASS): object 'MASS' not found

temp <- MASS
#> Error in eval(expr, envir, enclos): object 'MASS' not found

Created on 2018-10-05 by the reprex package (v0.2.1.9000)

Interactively, without running eval() you'll get the error message you have above:

temp <- MASS
#> Error: object 'MASS' not found
1 Like

Uhm, sorry, this answer slipped under my radar. Thank you for clarifying, I guess I'll just carry on being blissfully ignorant. :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.