[R] how to save output all together

From: Chun-Ying Lee <u9370004_at_cc.kmu.edu.tw>
Date: Mon 05 Dec 2005 - 12:49:52 EST


Dear R users:

I have a problem about catch the value from function. I have following two functions (part):

sbolus1 <- function()
{

  .......
  for( i in 1:Subject) {
  kel<-par1
  Vd<-par2
  PKindex<-sbolus1.out(PKtime,kel,Vd,defun,par1,par2,Dose,i)   }
  savefile(PKindex)
}

sbolus1.out<-function(PKtime,kel,Vd,defun,par1,par2,Dose,i)
{

  time<-PKtime$time
  parms<-c(kel=kel,Vd=Vd)
  C1.lsoda<-data.frame(lsoda(Dose/Vd,c(0,time),defun,parms))   cat("\n")
  sim<-matrix(c(kel,Vd,par1,par2),2,2)
  dimnames(sim)<-list(c("kel","Vd"),c("Value","Original"))   show(sim)
  cat("\n\n<< Output >>\n\n")
good<-ifelse(C1.lsoda[2:(length(time)+1),2]<=0,0,C1.lsoda[2:(length(time)+1),2])   PKindex<-data.frame(i,C1.lsoda[2:(length(time)+1),1],good)   colnames(PKindex)<-list("Subject","time","conc")   show(PKindex)
  x<-C1.lsoda[2:(length(time)+1),1]
  y<-good
  plotting.sim(i,x,y)
  return(PKindex)
}

In each loop, it can generate one PKindex(consisting of subject , time and concentration), and I want to save all the PKindex together. But in the command I wrote, I just can save the last one. For example, if i=2, I just save the data of subject 2. Please give me some comments about the problem. Thanks in agvance !!



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Dec 05 13:32:15 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:28 EST