I am looking for a way to double-click on file name in Windows Explorer directory (XP) that will open the R GUI and display the script (but not run it). In other works I want R to w开发者_如何学JAVAork in a similar way to opening a PDF (or pretty much every other program) from the Windows Explorer directory.
I have tried to find the appropriate .exe from Right Click -> Open With -> Choose Program route but to no avail. I have also tried moving the R icon from my Start | All Programs to the C:\Documents and Settings..\SendTo to allow me to select R from Right Click -> Send To -> R. This also failed.
Unless you have a compelling reason to use the default R editor, I recommend using one of the third party text editors for R. Lots of good details here: Recommendations for Windows text editor for R
I'll give a personal recommendation to the new kid on the block, R-studio: http://www.rstudio.org/
The following url:
http://research.stowers-institute.org/efg/R/TechNote/WindowsExplorerWorkingDirectory/index.htm
has information on how to set up windows so that you can right click on a folder in windows explorer and start R (you will need to update the file to more recent versions of R, but it still works).
This will not open the .R file for you, but you can then easily do that from the folder icon in the R GUI. I like this approach better, you still right click to run R and it runs in the folder you specify, but I often have 2 or more .R files that I want to open in the same instance of R (with your description above it is not clear whether the second file you did that with would open in the same instance of R or open a new one).
I also have the following line in my .Rprofile to help me keep track of the different instances of R that I have open:
utils::setWindowTitle(getwd())
精彩评论