I hadn’t seen an error message because I hadn’t tried it yet. I was leery of doing so for two reasons. First, I didn’t seen anything in the ?save page that said it was possible to save to a file and directory of the user’s choice, and later to retrieve it! It would be very useful to a novice like me if the ?save page had an example at the end showing that being done. (Frankly, many of the help pages seem very dense, and not sufficiently informative, to a novice like me.)

The second thing that made me leery of trying it was the text in the “R for Windows FAQ” in section 2.10, that made me think (evidently wrongly) that my projects had to be kept within R’s own directories.

I think you are suggesting that what I was asking about would work if I used forward slashes. I'll try that.

Thank you for the information you’ve provided.  It is helpful.

David


On 3/9/2014 3:05 PM, William Dunlap wrote:
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?

You did not show the error message you got from that failing command.
I get:
    > x <- 1
    > save("x", file="C:\am\myfiles\ProjectA.RData")
    Error: '\m' is an unrecognized escape in character string starting 
""C:\am\m"
    > "C:\am\myfiles\ProjectA.RData"
    Error: '\m' is an unrecognized escape in character string starting 
""C:\am\m"
which is intended to make it clear that "\m" is not legal in a string.  If, 
instead of 'escape'
it said 'backslashed character', would you have understood that the problem is
with how backslashes are represented in R strings?

Bill Dunlap
TIBCO Software
wdunlap tibco.com


-----Original Message-----
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf
Of Ista Zahn
Sent: Sunday, March 09, 2014 7:25 AM
To: David Parkhurst
Cc: r-help@r-project.org
Subject: Re: [R] Saving R files

Hi David,

Again, please keep the list copied.

I think the documentation is clear, but if you still have doubts why
don't you try it and see?

Best,
Ista

On Sat, Mar 8, 2014 at 11:39 PM, David Parkhurst <parkh...@imap.iu.edu> wrote:
That talks about saving to file ".RData".
I'm still asking, can I save to
files with an arbitrary name in any directory on my hard drive? Again, that
may be implied, but I wasn't confident that if I saved my workspace that
way, that I would be able get it back later, after working on other
projects.  I'd like to put files in specific places where I can find them,
such as to the file="C:\am\myfiles\ProjectA.RData" that I referred to in my
original posting.

David


On 3/8/2014 11:29 PM, Ista Zahn wrote:

On Sat, Mar 8, 2014 at 11:14 PM, David Parkhurst <parkh...@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 <parkh...@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 <istaz...@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
<parkh...@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@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.

______________________________________________
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.

Reply via email to