[R] data export HELP!

adriana1986 adriana.olijnyk at queensu.ca
Sun Jul 11 21:54:27 CEST 2010


Hello! 
So, this is going to seem like a very simple question - I am quite new to R
and am having some trouble figuring out little nuances:

I am running a loop that goes through my data and performs a nls parameter
estimation on each data set. At the end of the loop, I would like to collect
the parameter estimates in ONE SINGLE DATA FRAME or WRITE.TABLE that I can
import into excel. 

Here is my code: 


for(j in 1:dim(r)[2]){ 
        indiv=r[,j][which(r[,j]>-1)] #removes -1 growth data 
        age.1=age[1:length(indiv)] 
        length.ind=data.frame(age.1,indiv, row.names=TRUE) #data frame of
ages and length 
        
       
est.ind=nls(indiv~Linf*(1-exp(-K*(age.1-to))),start=lkt.A,data=length.ind) #
von b growth estimate 
        summary=summary(est.ind, correlation=TRUE) #gives parameter estimate
values 
        
        
        parameters=data.frame("Linf"=coef(est.ind)[1],"K"=coef(est.ind)[2])
#data frame of parameter estimates 
        
        } 

if I just type "parameters" I only get the parameter estimates for the LAST
individual that was in the loop. How can i combine EVERY SINGLE parameter
estimate into a data.frame or something of the sort and then export this set
of data into ONE csv file. I can do it using write.table within my loop, but
then I get 52 csv files -  I would like to avoid this. 

I hope this makes sense - any help would be GREATLY APPRECIATED!!!! 

thanks!
-- 
View this message in context: http://r.789695.n4.nabble.com/data-export-HELP-tp2285445p2285445.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list