Re: [R] working with environments to ensure code quality for long R scripts

2012-04-20 Thread Alexander
In fact, I took over the code of someone else, but I agree with you. It is really a mess and very hard to understand the code if you haven't programmed it. So you would suggest to put everything in functions and therefore have only very little return variables to work with. This also should limit t

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Bert Gunter
Comment (caveat emptor): If I understand correctly, your difficulties all stem from your use of the word "script," which betrays a fundamental misunderstanding of the nature of R as a programming language. R is based (mostly) on the concepts of functional programming. So instead of doing what as

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Alexander
Thank you for the idea with caching... Alexander Alexander wrote > > Hi > > thank you for your suggestions, but I am not sure if I explained my > problem well enough. Lets asume, that I have 30 different script files and > 1 script which calls these 30 scripts one after the other by "source".

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Alexander
Hi thank you for your suggestions, but I am not sure if I explained my problem well enough. Lets asume, that I have 30 different script files and 1 script which calls these 30 scripts one after the other by "source". Some of the 30 scripts only contain definitions of functions which are called in

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread cberry
Alexander, If Tal's suggestion to use caching in Sweave doesn't appeal to you, you might look at 'R.cache' and other packages mentioned in http://cran.r-project.org/web/views/ReproducibleResearch.html under 'Caching of R Objects'. However, an advantage of the Sweave-like approaches is that y

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Tal Galili
Hi Alexander, Saving full environments is possible, but it is very easy to start loosing track on where each variable came from. You might want to use this process: http://www.r-bloggers.com/a-better-way-of-saving-and-loading-objects-in-r/ It depends on how many variables you work with, but it migh