Tuesday, July 13, 2010

not a nested for loop--- but I got a regression loop unnested!!!

oh the happiness-- I still must figure out how to nest the columns, but i managed to tell it to do one column versus another FOR a whole transect..... want to see? prepare for the ugliest code ever, which could probably be summarized by something... but hell, i made it work! summary later! work now!

look at that loop right there... mmmm....

for(i in c(1:11)) print(folbio<-nls(transect1[[i]]${YearsACC~nonlin(transect1[[i]]}$NbioF, intercept, power), data=transect1[[i]], start=list(intercept=0, power=0.5), trace=T))

3 comments:

  1. Hey I edited your post a little bit -- the Latex add on thing was messing up your code. And nice work on the regression loop -- nested for loops are something that should be avoided if possible! You're outdoing me in programming already :)

    ReplyDelete
  2. Thanks!

    I've got about 75% of the regressions done-- I'm putting them in a spreadsheet now to see which didn't converge, then I can just go back and change the function form to the other one that comes up sometimes or do the real pain in the ass ones by hand... so much less pain than how I was doing it before, hell, I could even have a good bit of information by my meeting on thrusday!

    ReplyDelete
  3. If you ask me successfully automating an annoying, repetitive task like this is just an awesome feeling. You just sort of sit there and feel smug as the script does all the work for you.

    ReplyDelete