[R] save objects of own function to workspace

Rolf Turner rolf.turner at xtra.co.nz
Wed Feb 15 22:23:42 CET 2012


On 16/02/12 03:59, Marion Wenty wrote:

<SNIP>
> Thank you for your answers!
>
> Jeff, thanks very much for the tip with the<<- instead of using<- to save
> the objects outside of the function, as well! I find this very usefull and
> convenient, also if I decide to choose more objects.
<SNIP>

This practice is to be *STRONGLY* discouraged.  If you persist,
you will live to regret it.

Write functions that return (arbitrarily complicated) objects and
assign the output of functions to objects.  DO NOT write functions
that mess around with your global environment.  Unless you *really*
know what you're doing --- and it's pretty clear that at this stage of
your development, you don't.

     cheers,

         Rolf Turner



More information about the R-help mailing list