Re: [R] Opening a .R file with R (Windows)
On Tue, Sep 28, 2010 at 1:11 PM, Kye Gilder wrote: > I am new to using R. I installed R on my computer (Windows) and everything > things appears to be just fine. However, I have a simple script RTest.R > that does a few simple calculations. When I double-click the RTest.R icon, > I get an Information dialong box which says, "ARGUMENT 'C:\Documents and > Settings\kgilder\Desktop\RTest.R' __ignored__" . When I choose OK, R then > opens, but it does not open or display the script. Any help or suggestions? > > When I open R and use File >> Open New Script and path to the file, it opens > just fine. There is a batch file called #Rscript.bat at http://batchfiles.googlecode.com . If you (1) place #Rscript.bat anywhere on your path and then (2) place this line at the top of your R file: #Rscript %0 %* and (3) rename your R file to end in .bat then it can be used as both a bat file and as an R file. If you double click it then it will run the script since its a bat file yet you can also source() it into R like any R file.It does produce one garbage line of output at the top so it will only be usable in situations where that is ok. Note that #Rscript.bat finds R from the registry so if you upgrade R you will not need to make any changes to your scripts that use it. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Opening a .R file with R (Windows)
Here's a thread that has some good discussion on the topic http://r.789695.n4.nabble.com/Running-script-with-double-click-td1579014.html -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter Sent: Tuesday, September 28, 2010 1:48 PM To: Joshua Wiley Cc: r-help@r-project.org Subject: Re: [R] Opening a .R file with R (Windows) Well, try following the correct conventions ... 1. Double click on an .Rdata file, which is produced by saving from R, and it will open. 2. Drag and drop a .R or any text file into an open R window and it will source the contents. This is probably documented somewhere .. maybe in the RW FAQ. -- Bert On Tue, Sep 28, 2010 at 10:22 AM, Joshua Wiley wrote: > Hi Kye, > > I have never gotten .R files to work quite like other types (e.g., > double-clicking a .PDF) in Windows. AFAIK there is no simple way to > do it, because you do not edit scripts directly in R (I am happy to be > corrected if someone knows better). For general use, I would just > open R first and then open the file, or if you just want to run the > file, you can use R's batch mode from the Windows command prompt. > > Best regards, > > Josh > > On Tue, Sep 28, 2010 at 10:11 AM, Kye Gilder wrote: >> >> I am new to using R. I installed R on my computer (Windows) and >> everything things appears to be just fine. However, I have a simple >> script RTest.R that does a few simple calculations. When I >> double-click the RTest.R icon, I get an Information dialong box which >> says, "ARGUMENT 'C:\Documents and Settings\kgilder\Desktop\RTest.R' >> __ignored__" . When I choose OK, R then opens, but it does not open or >> display the script. Any help or suggestions? >> >> When I open R and use File >> Open New Script and path to the file, >> it opens just fine. >> Regards, >> >> Kye >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > > > -- > Joshua Wiley > Ph.D. Student, Health Psychology > University of California, Los Angeles > http://www.joshuawiley.com/ > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Bert Gunter Genentech Nonclinical Biostatistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. === P Please consider the environment before printing this e-mail Cleveland Clinic is ranked one of the top hospitals in America by U.S.News & World Report (2009). Visit us online at http://www.clevelandclinic.org for a complete listing of our services, staff and locations. Confidentiality Note: This message is intended for use\...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Opening a .R file with R (Windows)
Hi One workaround in Windows You shall have SendTo folder located somewhere in system (depending on Windows version). Put a shortcut to R programme in that folder. Than you can click with right mouse button on *.r file, select send to and choose appropriate shortcut (in that case R) but you can use it for other programs too. Regards Petr r-help-boun...@r-project.org napsal dne 28.09.2010 19:22:22: > Hi Kye, > > I have never gotten .R files to work quite like other types (e.g., > double-clicking a .PDF) in Windows. AFAIK there is no simple way to > do it, because you do not edit scripts directly in R (I am happy to be > corrected if someone knows better). For general use, I would just > open R first and then open the file, or if you just want to run the > file, you can use R's batch mode from the Windows command prompt. > > Best regards, > > Josh > > On Tue, Sep 28, 2010 at 10:11 AM, Kye Gilder wrote: > > > > I am new to using R. I installed R on my computer (Windows) and everything > > things appears to be just fine. However, I have a simple script RTest.R > > that does a few simple calculations. When I double-click the RTest.R icon, > > I get an Information dialong box which says, "ARGUMENT 'C:\Documents and > > Settings\kgilder\Desktop\RTest.R' __ignored__" . When I choose OK, R then > > opens, but it does not open or display the script. Any help or suggestions? > > > > When I open R and use File >> Open New Script and path to the file, it opens > > just fine. > > Regards, > > > > Kye > > > >[[alternative HTML version deleted]] > > > > __ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > -- > Joshua Wiley > Ph.D. Student, Health Psychology > University of California, Los Angeles > http://www.joshuawiley.com/ > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Opening a .R file with R (Windows)
Well, try following the correct conventions ... 1. Double click on an .Rdata file, which is produced by saving from R, and it will open. 2. Drag and drop a .R or any text file into an open R window and it will source the contents. This is probably documented somewhere .. maybe in the RW FAQ. -- Bert On Tue, Sep 28, 2010 at 10:22 AM, Joshua Wiley wrote: > Hi Kye, > > I have never gotten .R files to work quite like other types (e.g., > double-clicking a .PDF) in Windows. AFAIK there is no simple way to > do it, because you do not edit scripts directly in R (I am happy to be > corrected if someone knows better). For general use, I would just > open R first and then open the file, or if you just want to run the > file, you can use R's batch mode from the Windows command prompt. > > Best regards, > > Josh > > On Tue, Sep 28, 2010 at 10:11 AM, Kye Gilder wrote: >> >> I am new to using R. I installed R on my computer (Windows) and everything >> things appears to be just fine. However, I have a simple script RTest.R >> that does a few simple calculations. When I double-click the RTest.R icon, >> I get an Information dialong box which says, "ARGUMENT 'C:\Documents and >> Settings\kgilder\Desktop\RTest.R' __ignored__" . When I choose OK, R then >> opens, but it does not open or display the script. Any help or suggestions? >> >> When I open R and use File >> Open New Script and path to the file, it opens >> just fine. >> Regards, >> >> Kye >> >> [[alternative HTML version deleted]] >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > > > -- > Joshua Wiley > Ph.D. Student, Health Psychology > University of California, Los Angeles > http://www.joshuawiley.com/ > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Bert Gunter Genentech Nonclinical Biostatistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Opening a .R file with R (Windows)
Hi Kye, I have never gotten .R files to work quite like other types (e.g., double-clicking a .PDF) in Windows. AFAIK there is no simple way to do it, because you do not edit scripts directly in R (I am happy to be corrected if someone knows better). For general use, I would just open R first and then open the file, or if you just want to run the file, you can use R's batch mode from the Windows command prompt. Best regards, Josh On Tue, Sep 28, 2010 at 10:11 AM, Kye Gilder wrote: > > I am new to using R. I installed R on my computer (Windows) and everything > things appears to be just fine. However, I have a simple script RTest.R > that does a few simple calculations. When I double-click the RTest.R icon, > I get an Information dialong box which says, "ARGUMENT 'C:\Documents and > Settings\kgilder\Desktop\RTest.R' __ignored__" . When I choose OK, R then > opens, but it does not open or display the script. Any help or suggestions? > > When I open R and use File >> Open New Script and path to the file, it opens > just fine. > Regards, > > Kye > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Opening a .R file with R (Windows)
I am new to using R. I installed R on my computer (Windows) and everything things appears to be just fine. However, I have a simple script RTest.R that does a few simple calculations. When I double-click the RTest.R icon, I get an Information dialong box which says, "ARGUMENT 'C:\Documents and Settings\kgilder\Desktop\RTest.R' __ignored__" . When I choose OK, R then opens, but it does not open or display the script. Any help or suggestions? When I open R and use File >> Open New Script and path to the file, it opens just fine. Regards, Kye [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.