-----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 part of a document (in org-mode / emacs). I have several datasets which are loaded, and each one is quite big. So after doing one part of the job (e.g. analysing the data and storing the results) I want to delete all variables used to free space and to avoid having these variables being used in the next block and still having the old (for this block invalid) values. I can't use rm(list=ls()) as I have some variables as "constants" which do not change over the whole document and also some functions defined. I could put each block in a function and then call the function and delete it afterwards, but this is as I see it abusing functions. I don't want to keep track manually of the variables. Therefore my question: Can I do something like: x <- 15 { #here begins the block a <- 1:100 b <- 4:400 } # here ends the block # here are and b not defined anymore # but x is still defined {} is great for grouping the commands, but the variables are not deleted afterwards. Am I missing a language feature in R? Rainer - -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.22 (Darwin) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJS3SDSAAoJENvXNx4PUvmCEAwH/jBCuQLRpRcPu+PSrUBsck8v 49q3f0wAZqhyfjMQvRnLSECAfQN4GHI1WvXcuC9R8Z0eokL7gAqMnJSgWd61Un0F I+yClK1qbhpCwR8WV4nDXTuEW5rb5d8a1iHRPxXXSi/vdJZL3imWMsfvGTpgIhVw Dbi7+BSh52ZFEZPIyTm2+4qBfQA2ZaY3AEPTjBdB4iL603S+lpgmm1mAInFHFx5g 0CzzY3feTWreD+EATXMGofTDaoxR5vuLvIRvv+PA/Ehz/hVnQah2xriL4NR+pIHz 7WbqiReJ8H1ruAgtW6o8CmQRMArHmk0oBy1vYQvwB7SZ8/DOyKkArKBy8tGx/J0= =dBo5 -----END PGP SIGNATURE----- ______________________________________________ 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.