[R] Query on save.image()

2010-10-14 Thread Megh Dal
Can anyone please tell me how can use save.image() function if it is placed within a function (i.e. some level up from the base level environment)? Here I experimented with following codes: #rm(list=ls()) fn - function() { x - rnorm(5) save.image(f:/dat.RData) } fn() However I see

Re: [R] Query on save.image()

2010-10-14 Thread Joshua Wiley
Hi, I do not believe you can use the save.image() function in this case. save.image() is a wrapper for save() with defaults for the global environment (your workspace). Try this instead, I believe it does what you are after: myfun - function(x) { y - 5 * x + x^2 save(list = ls(envir =

Re: [R] Query on save.image()

2010-10-14 Thread Hadley Wickham
On Thu, Oct 14, 2010 at 11:56 AM, Joshua Wiley jwiley.ps...@gmail.com wrote: Hi, I do not believe you can use the save.image() function in this case. save.image() is a wrapper for save() with defaults for the global environment (your workspace).  Try this instead, I believe it does what you

Re: [R] Query on save.image()

2010-10-14 Thread Joshua Wiley
, --- On Thu, 10/14/10, Joshua Wiley jwiley.ps...@gmail.com wrote: From: Joshua Wiley jwiley.ps...@gmail.com Subject: Re: [R] Query on save.image() To: Megh Dal megh700...@yahoo.com Cc: r-h...@stat.math.ethz.ch Date: Thursday, October 14, 2010, 10:26 PM Hi, I do not believe you can use

Re: [R] Query on save.image()

2010-10-14 Thread Megh Dal
the same against envir. By putting so, what I am going to tell R? Thanks, --- On Thu, 10/14/10, Joshua Wiley jwiley.ps...@gmail.com wrote: From: Joshua Wiley jwiley.ps...@gmail.com Subject: Re: [R] Query on save.image() To: Megh Dal megh700...@yahoo.com Cc: r-h...@stat.math.ethz.ch Date: Thursday