Open mrdwab opened 11 years ago
That sounds like a great idea. I checked what happens if you put source("~/.active-rstudio-document", echo=TRUE)
in your script absent-mindedly and it gives Error in mode(expr) : node stack overflow
, which I thought was appropriate.
I'm just trying to think how to differentiate those three options. It's difficult to use switch for the curly braces situation as that will cause it to be evaluated prematurely. Perhaps something like function(x, type) where type is one of "code", "rstudio" or "clipboard" (or even R file?).
Ah, I just found out that the latest version of devtools includes a set of eval_clean
functions which essentially do the same thing as this function does.
I think SOcheck is a great idea, but I wonder if re-entering code in curly braces is going to be the typical usage scenario.
Perhaps it can be extended in the following way: Allow as input either:
This could probably be done easily with a
switch
statement, and I think it would make the function a little bit more practical to use. For example, a lot of times, I would have a separate script tab open in RStudio where I write the code for my SO answers. It would be more useful for me if I could simply typeSOcheck()
in the console, and have the active document checked with vanilla R.