[R] saving an R script

Robert Baer rb@er @end|ng |rom @t@u@edu
Fri May 10 15:42:33 CEST 2019


I agree that an editor or a development environment like RStudio is the 
best answer, but perhaps savehistory() function is what you are looking for.

On 5/10/2019 8:32 AM, Doran, Harold wrote:
> David
>
> Most of us use an editor of some kind to write our code. I use Notepad++ but there are many options. In this way, you simply write your code in a text file and save it.
>
> Some editors allow for you to execute your code from the script.
>
> -----Original Message-----
> From: R-help <r-help-bounces using r-project.org> On Behalf Of David Winters
> Sent: Thursday, May 09, 2019 10:54 PM
> To: r-help using r-project.org
> Subject: [R] saving an R script
>
> Greetings,
>
> This is a super embarrassing question. But, how do you save an R script with code? that is, not doing it the cheat way? where you just hit the "save" button? what function would it be?
>
> I know how to save the environment in code:
>
> save.image(file='myEnvironment.RData')
> quit(save='no')
> load('myEnvironment.RData')
>
> But how would I do the same thing with a script? rather than the environment?
>
> David
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see 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 using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

-- 


--
Robert W. Baer, Ph.D.
Professor of Physiology
Kirksville College of Osteopathic Medicine
A T Still University of Health Sciences
800 W. Jefferson St
Kirksville, MO 63501
660-626-2321 Department
660-626-2965 FAX



More information about the R-help mailing list