[R] saving an R script

Jeff Newmiller jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Fri May 10 15:42:04 CEST 2019

Don't. Not from within R.

Edit your script in a text editor, and save it using the usual method for that editor. You can copy lines from that file and paste them into the R console to confirm that each part of your script works, or save it regularly and use the source function from within the R console to have R run the whole thing.

One reason why Integrated Development Environments (IDEs) like RStudio and ESS are so popular is that they turn these steps into a hot-key keyboard combination accessible from the text editor. (They also tend to provide typing completion help that helps you enter syntactically correct code more quickly, and display variable contents in a side bar.) But this is the R-help mailing list, where the topic is the language, not the tools, and you should not assume here that anyone else is using the same editor/IDE that you are.

On May 9, 2019 7:54:10 PM PDT, David Winters <winters.david.p using gmail.com> wrote:
>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:
>But how would I do the same thing with a script? rather than the
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>PLEASE do read the posting guide
>and provide commented, minimal, self-contained, reproducible code.

Sent from my phone. Please excuse my brevity.

More information about the R-help mailing list