2008/10/16 Michael Just <[EMAIL PROTECTED]>: >> On Thu, 16 Oct 2008, Michael Just wrote:
> I think I am still a beginner, hence all the questions. I am pretty > sure my code has redundancies and I use excel as an text editor, its > the fastest way I know how (lots of "dragging formulas"). I have > 1,000's because I have 1000's of locations in my dataset and I am > running a few regressions on each. I think that this 1,000's of lines > R code should not discredit my 'beginner' status. I am still just > using univariate statistics and learning how to do EDA in R. Having 1,000s of lines of R code that do almost the same thing 1000 times is not beginner R status, it's beginner programmer status. You should never have: doThing(1) doThing(2) doThing(3) ... for 1000 lines. Can you see what would be better? for(i in 1:1000){doThing(i)} Why is it better? Because I can make it go to 10,000 by adding one character. Because I can see the whole thing on one line. Because it just IS. In the most beautiful programs, everything unique only happens exactly once[1]. For example if your dataset is of size 143, you don't have all your loops going for(i in 1:143) - you do size=143 and then use for(i in 1:size). It makes things much more easy to maintain, modify, and reuse. Maybe you could post an extract from this big file so we can get the gist of what you are doing. Barry [1] This may be a bit too zen for a Thursday ______________________________________________ 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.