(Don't post in HTML. Your code is illegible that way.) Something as simple as ... return(ts) ... to conclude your function perhaps?
B. On May 18, 2015, at 7:32 AM, Ariadna García Sáenz <qui...@msn.com> wrote: > Good afternoon, > I'm working in a disease spread model, and I have to use a function to put > information on a table. > My question is that I don't know how to get the output of this function in a > table. Thanks in advance! > Here I paste my script: > tbmodel <- function(time,S,E,I,De,Di,beta,alpha,phi,rho){ ts <- > data.frame(time=sim.time,S=susceptibles,E=exposed,I=infectious,De=De,Di=Di) > next.time <- ts > while(next.time$time<limit.time&next.time$S>0&next.time$E>=0&next.time$I>=0) > # Conditions under which within-herd spread continues { next.time > <-gillespie(next.time$time,next.time$S,next.time$E, > next.time$I,next.time$De,next.time$Di,beta,alpha,phi,rho) ts <- > rbind(ts,next.time) if(ts$time[nrow(ts)]>limit.time|ts$E[nrow(ts)]<0)ts <- > ts[-nrow(ts),] # Elimination of last column (time> limit.time) } > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.