Hi :
It's not clear whether you want to save your code, your R object or both.
Tal has already directed you to help for saving objects created in your
workspace. As for saving the code, many people write their code in an editor
and either copy/paste it into the workspace or, with certain editors, mark
text to be sent to the R console directly. You can use almost any editor to
copy/paste code, but some, like Eclipse and Emacs, can interface with the R
console directly.
It's a good idea to keep your code somewhere outside the R console in case
of a crash, but it is also easier to modify and organize code in an editor
and send it to R, especially if you're making a lot of changes on the fly or
writing functions. I use Emacs and Eclipse myself, but other editors, such
as Tinn-R, have similar capabilities.
A tutorial to configure Eclipse with StatET, its R plug-in:
http://www.splusbook.com/R_Eclipse_StatET.pdf
A blog post that provides steps to configure Eclipse with StatET and
TeXlipse, in case you want/need to use Sweave in conjunction with R at some
point:
http://www.r-bloggers.com/getting-started-with-sweave-r-latex-eclipse-statet-texlipse/
The home page of ESS (Emacs Speaks Statistics):
http://ess.r-project.org/index.php?Section=home
Emacs is kind of an 'all-in-one' editor that lets you work on several
projects simultaneously - with ESS, for example, you could be working on a
text document in one buffer, an R document in another, a C program in a
third, etc. Most of the R veterans who use it swear by it - I like it, too
:) If you want it, the best option on Windows or Mac is to use the
installer provided by Vincent Goulet, who did a wonderful job in producing
it. Eclipse has similar capabilities and may be a better choice if you
program in Java, Python or C++ regularly.
Home page for Tinn-R:
http://www.sciviews.org/Tinn-R/
All three of these editors are external to R but have the capability of
sending code from the editor to the console. All of them are good and have
loyal user bases. Notepad++ is another option; but you have to copy/paste
code to R - I mention it because it has syntax highlighting and is capable
of saving files in numerous formats.
In fact, all of the editors mentioned above have syntax highlighting
capabilities, which is very useful when writing/developing code and
documents, and all of them let you save a file with a .R extension (unlike
certain Windows editors, for example). I'm certain I've missed a few,
especially on the Linux and Mac platforms, and I expect others will chime in
with their preferences.
HTH,
Dennis
On Sun, Oct 24, 2010 at 11:57 PM, zhiji19 <zhiji19@gmail.com> wrote:
>
> Hello everyone
>
> Can you please teach me how to save my homework as .R file?
>
> I write my code in RGui. When I tried to save my work, the RGui only allows
> me to save it as .RData.
>
> By the way, after I save my work as .RData, I cannot reopen it. when I open
> it, only one message comes out as following: "ARGUMENT_ignored_."
> --
> View this message in context:
> http://r.789695.n4.nabble.com/R-file-tp3009812p3009812.html
> Sent from the R help mailing list archive at Nabble.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.
>
[[alternative HTML version deleted]]