[R-sig-dyn-mod] deSolve warning and error messages
Thomas Petzoldt
Thomas.Petzoldt at tu-dresden.de
Wed Feb 20 11:57:04 CET 2013
Dear Ekaterina,
you are probably right, not all outputs can be suppressed with
suppressWarnings and I will look at it as soon as possible.
For the moment, the following workaround may help.
Thomas
##--------------------------------------------------------------
library(deSolve)
lng <- 100
times <- seq(1, 100, length=lng)
simpleFun<-function(t,y, parms=NULL){
p <- array(y, dim=c(2, 2))
age <- 1:101
tab<-cbind(
-seq(0.1, 5, length=101), seq(0.8, 0.1, length=101),
seq(0.1, 5, length=101), -seq(0.8, 0.1, length=101)
)
i <- max(which(age <= t))
q <- array(tab[i,], dim=c(2,2))
vec<-c(p %*% q)
list(vec)
}
runSilent <- function() {
options(warn = -1)
on.exit(options(warn = 0))
capture.output(res <- lsoda(y=diag(2), times=times,
func=simpleFun, parms=NULL, maxsteps=10))
res
}
res <- runSilent()
res
More information about the R-sig-dynamic-models
mailing list