[R] Saving R files
Ista Zahn
istazahn at gmail.com
Sun Mar 9 05:29:14 CET 2014
On Sat, Mar 8, 2014 at 11:14 PM, David Parkhurst <parkhurs at imap.iu.edu> wrote:
> The penultimate line in ?rm is "rm(list = ls())". I don't see anything that
> specific in ?save, and that's why I asked. Perhaps there's language in
> ?save that implies that to those more experienced in R than I am, but I'm
> not that experienced.
Yes--see e.g., the second paragraph of the description in ?save:
" ‘save.image()’ is just a short-cut for ‘save my current
workspace’, i.e., ‘save(list = ls(all = TRUE), file = ".RData")’.
It is also what happens with ‘q("yes")’."
The documentation of the arguments list to save (especially the "list"
argument) will also tell you that you can pass a character vector of
object names to be saved. Such a vector can be returned from 'ls()'.
Best,
Ista
> David
>
>
> On 3/8/2014 10:07 PM, Ista Zahn wrote:
>>
>> Hi David,
>> Please keep the list copied, that will give someone else an
>> opportunity to respond to you as well (I've cc'd the list here).
>>
>>
>> On Sat, Mar 8, 2014 at 8:42 PM, IU <parkhurs at imap.iu.edu> wrote:
>>>
>>> Thank you---but can't you tell from what I wrote that I DID read ?save,
>>> and didn't see the answer to my question there.
>>
>>
>> To be honest, no. You say you guessed at the the syntax based on what
>> you read in ?rm. Why you would do that instead of referring directly
>> to ?save is made me suspect that you didn't actually read the
>> documentation, especially since the relevant arguments are the same in
>> both functions. At any rate, what is it you find unclear about the
>> documentation for the save function? It all seems pretty clear to me,
>> but then I've been reading R documentation for some time. Perhaps if
>> you explain what you didn't understand someone can help you clarify.
>>>
>>>
>>> And thanks for the reminder about the FAQ.
>>
>>
>> Sure, anytime.
>>
>> Best,
>> Ista
>>
>>>
>>> DFP (iPad)
>>>
>>>> On Mar 8, 2014, at 8:31 PM, Ista Zahn <istazahn at gmail.com> wrote:
>>>>
>>>> Hi David,
>>>>
>>>> Did you actually read the help file for 'save'? The answer to your
>>>> fist question is there. The answer to your second question is in
>>>> section 2.16 of the 'R for Windows FAQ'.
>>>>
>>>> Best,
>>>> Ista
>>>>
>>>>> On Sat, Mar 8, 2014 at 7:45 PM, David Parkhurst <parkhurs at imap.iu.edu>
>>>>> wrote:
>>>>> Sometimes I don't understand the details of writeups I get, with ?save
>>>>> and
>>>>> the like. Anyway, that's my problem now.
>>>>>
>>>>> Can I do this (in Windows 7) to save everything that comes up with
>>>>> ls(),
>>>>> guessed at by what I find with ?rm:
>>>>>
>>>>> save(list=ls(),file="C:\am\myfiles\ProjectA.RData")
>>>>>
>>>>> Or would I need forward slashes, but this would otherwise work? If
>>>>> not, how
>>>>> could I accomplish this goal?
>>>>>
>>>>> David
>>>>>
>>>>> ______________________________________________
>>>>> R-help at 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.
More information about the R-help
mailing list