Re: [R] Make a function work on an environemnt

2011-08-27 Thread Tyler Rinker
A previous attempt at this question resulted in the message running together, making the message difficult to read and the code lines hard to distinquinsh. In my R learning I've come across a situation in which a piece of code that works on the work space outside a function does not work

Re: [R] Make a function work on an environemnt

2011-08-27 Thread R. Michael Weylandt
Well, here's one way you could do it: # Don't run this unless you really mean it clear - function(){rm(list=ls(.GlobalEnv), envir = .GlobalEnv)} Both calls to .GlobalEnv seem necessary so that both rm() and ls() go everywhere with it. However, this certainly isn't the most useful code because it

Re: [R] Make a function work on an environemnt

2011-08-27 Thread Tyler Rinker
Michael, Thank you for that information. It was very insightful. Anyone else with why my second attempt does not work (using eapply)? ThanksTylerFrom: michael.weyla...@gmail.com Date: Sat, 27 Aug 2011 12:01:02 -0400 Subject: Re: [R] Make a function work on an environemnt To: tyler_rin

Re: [R] Make a function work on an environemnt

2011-08-27 Thread Tyler Rinker
to apply the function to global environment though. You were certainly helpful there. From: michael.weyla...@gmail.com Date: Sat, 27 Aug 2011 12:01:02 -0400 Subject: Re: [R] Make a function work on an environemnt To: tyler_rin...@hotmail.com CC: r-help@r-project.org Well, here's one way you could

[R] Make a function work on an environemnt

2011-08-26 Thread Tyler Rinker
In my R learning I've come across a situation in which a piece of code that works on the work space outside a function does not work inside the function. WARNING THIS EMAIL CONTAINES THE CODE:#rm(list=ls()) THIS WILL CLEAR ALL OBJECTS FROM YOUR WORKSPACE! When I use rm(list=ls()) and then