On Aug 15, 2010, at 10:58 AM, Stephen Liu wrote:

----- Original Message ----

From: David Winsemius <dwinsem...@comcast.net>
To: JesperHybel <jesperhy...@hotmail.com>
Cc: r-help@r-project.org
Sent: Sat, August 14, 2010 5:44:00 PM
Subject: Re: [R] Learning ANOVA


Hi David,

- snip -

JH > Also how to save InsectSprays.aov? I think I can only save it as
InsectSprays.csv.  I can't find "write.aov" command.

If you want to save an R object such as that returned by a function like aov, there are several ways. The save() function will create a compacted form that can then be read back into an R session with load(). >The dump() and dput() functions will turn an object into an ASCII representation that can be saved as a text file. If you only want to have the text that is produced when you "print" it (and this is what you >implicitly get when to just call the function at the
console), then use sink() or capture.output().


Whether run;
save(InsectSprays.aov, file="InsectSprays.rda")
?

How to select the path and directory for saving the file?

Try this:

save(InsectSprays.aov, file=file.choose() # and save it in a location that you will be able to remember.

To load the file;
load(InsectSprays.rda) That would not work because you did not quote the argument. The R interpreter went looking for a a character valued object named InsectSprays.rda and didn't find one in its workspace.

?

Then try this:
load(file.choose()) # and navigate to whatever folder in which you save the file.



I looked at ?dump and ?dput and couldn't resolve how to run them creating ASCII
and text file.  Please help.  TIA


"InsectSprays.aov" is an object - in this case probably a list.

Not "probably"; it is a list. Look at it with str if you have questions.

This is just to get you started. You also need to learn how to properly name your files in your operating system. Since it is a Mac, you can drag a file to the console from a Finder window and a correct text specification of the file will appear. Put quotes around it and you cna use it as an argument to laod or as an arguemtnt to file in save.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
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