[R] Grouping commands so that variablas are removed automatically - like functions

2014-01-20 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I would like to group commands, so that after a group of commands has been executed, the variables defined in that group are automatically deleted. My reasoning: I have a longer sript which is used to load data, do analysis and plot graphs, all

Re: [R] Grouping commands so that variablas are removed automatically - like functions

2014-01-20 Thread jim holtman
Check out the use of the 'local' function: gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 199420 10.7 407500 21.8 35 18.7 Vcells 308004 2.4 786432 6.0 786424 6.0 result - local({ + a - rnorm(100) # big objects + b - rnorm(100) + mean(a + b)

Re: [R] Grouping commands so that variablas are removed automatically - like functions

2014-01-20 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 01/20/14, 14:27 , jim holtman wrote: Check out the use of the 'local' function: True - have completely forgotten the local function. Thanks, Rainer gc() used (Mb) gc trigger (Mb) max used (Mb) Ncells 199420 10.7 407500 21.8 35