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

Extending flexibility of SOcheck #12

Open
mrdwab opened this issue Mar 26, 2013 · 3 comments
Open

Extending flexibility of SOcheck #12

mrdwab opened this issue Mar 26, 2013 · 3 comments

Comments

@mrdwab
Copy link
Contributor

mrdwab commented Mar 26, 2013

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:

  1. Contents within curly braces, as you've done
  2. Access to "clipboard"
  3. Copying the contents of "~/.active-rstudio-document" as the sourcefile (working under the assumption that RStudio is a popular IDE for R)

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 type SOcheck() in the console, and have the active document checked with vanilla R.

@sebastian-c
Copy link
Owner

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.

@sebastian-c
Copy link
Owner

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?).

@sebastian-c
Copy link
Owner

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.

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

No branches or pull requests

2 participants