[Pomp-commits] r12 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jul 25 11:27:06 CEST 2008
Author: kingaa
Date: 2008-07-25 11:27:06 +0200 (Fri, 25 Jul 2008)
New Revision: 12
Modified:
pkg/R/compare.mif.R
pkg/R/dmeasure-pomp.R
pkg/R/dprocess-pomp.R
pkg/R/euler.R
pkg/R/init.state-pomp.R
pkg/R/mif-methods.R
pkg/R/mif.R
pkg/R/particles-mif.R
pkg/R/pfilter.R
pkg/R/plot-pomp.R
pkg/R/pomp-methods.R
pkg/R/pomp.R
pkg/R/rmeasure-pomp.R
pkg/R/rprocess-pomp.R
pkg/R/simulate-pomp.R
pkg/R/skeleton-pomp.R
pkg/R/sobol.R
Log:
improve error handling: fix language and use sQuote, dQuote where appropriate
Modified: pkg/R/compare.mif.R
===================================================================
--- pkg/R/compare.mif.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/compare.mif.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -2,7 +2,7 @@
## assumes that x is a list of mifs with identical structure
if (!is.list(z)) z <- list(z)
if (!all(sapply(z,function(x)is(x,'mif'))))
- stop("compare.mif error: 'z' must be a mif object or a list of mif objects",call.=FALSE)
+ stop("compare.mif error: ",sQuote("z")," must be a mif object or a list of mif objects",call.=FALSE)
mar.multi <- c(0,5.1,0,2.1)
oma.multi <- c(6,0,5,0)
xx <- z[[1]]
Modified: pkg/R/dmeasure-pomp.R
===================================================================
--- pkg/R/dmeasure-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/dmeasure-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -8,7 +8,7 @@
silent=FALSE
)
if (inherits(val,'try-error'))
- stop("dmeasure error: error in user 'dmeasure'",call.=FALSE)
+ stop("dmeasure error: error in user ",sQuote("dmeasure"),call.=FALSE)
val
}
)
Modified: pkg/R/dprocess-pomp.R
===================================================================
--- pkg/R/dprocess-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/dprocess-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -9,7 +9,7 @@
silent=FALSE
)
if (inherits(x,'try-error'))
- stop("dprocess error: error in user 'dprocess'",call.=FALSE)
+ stop("dprocess error: error in user ",sQuote("dprocess"),call.=FALSE)
x
}
)
Modified: pkg/R/euler.R
===================================================================
--- pkg/R/euler.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/euler.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -16,10 +16,10 @@
}
} else if (is.function(step.fun)) {
if (!all(c('x','t','params','delta.t','...')%in%names(formals(step.fun))))
- stop("'step.fun' must be a function of prototype 'step.fun(x,t,params,delta.t,...)'")
+ stop(sQuote("step.fun")," must be a function of prototype ",sQuote("step.fun(x,t,params,delta.t,...)"))
efun <- step.fun
} else {
- stop("'step.fun' must be either a function or the name of a compiled routine")
+ stop(sQuote("step.fun")," must be either a function or the name of a compiled routine")
}
.Call(
@@ -57,10 +57,10 @@
}
} else if (is.function(dens.fun)) {
if (!all(c('x1','x2','t1','t2','params','...')%in%names(formals(dens.fun))))
- stop("'dens.fun' must be a function of prototype 'dens.fun(x1,x2,t1,t2,params,...)'")
+ stop(sQuote("dens.fun")," must be a function of prototype ",sQuote("dens.fun(x1,x2,t1,t2,params,...)"))
efun <- dens.fun
} else {
- stop("'dens.fun' must be either a function or the name of a compiled routine")
+ stop(sQuote("dens.fun")," must be either a function or the name of a compiled routine")
}
.Call(
Modified: pkg/R/init.state-pomp.R
===================================================================
--- pkg/R/init.state-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/init.state-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -10,7 +10,7 @@
silent=FALSE
)
if (inherits(x,'try-error'))
- stop("init.state error: error in user 'initializer'",call.=FALSE)
+ stop("init.state error: error in user ",sQuote("initializer"),call.=FALSE)
x
}
)
Modified: pkg/R/mif-methods.R
===================================================================
--- pkg/R/mif-methods.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/mif-methods.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -55,7 +55,7 @@
predvarplot.mif <- function (object, pars, type = 'l', mean = FALSE, ...) {
if (!is(object,'mif'))
- stop("predvarplot error: 'object' must be of class 'mif'",call.=FALSE)
+ stop("predvarplot error: ",sQuote("object")," must be of class ",sQuote("mif"),call.=FALSE)
if (missing(pars))
pars <- object at pars
npv <- pred.var(object,pars)/(object at random.walk.sd[pars]^2)
Modified: pkg/R/mif.R
===================================================================
--- pkg/R/mif.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/mif.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -20,11 +20,11 @@
"pomp",
function (object, Nmif = 1,
start,
- pars = stop("'pars' must be specified"),
+ pars = stop(sQuote("pars")," must be specified"),
ivps = character(0),
particles,
- rw.sd = stop("'rw.sd' must be specified"),
- alg.pars = stop("'alg.pars' must be specified"),
+ rw.sd = stop(sQuote("rw.sd")," must be specified"),
+ alg.pars = stop(sQuote("alg.pars")," must be specified"),
weighted = TRUE, tol = 1e-17, warn = TRUE, max.fail = 0,
verbose = FALSE, .ndone = 0) {
if (missing(particles)) { # use default: normal distribution
@@ -47,17 +47,17 @@
particles <- match.fun(particles)
}
if (!all(c('Np','center','sd','...')%in%names(formals(particles))))
- stop("mif error: 'particles' must be a function of prototype 'particles(Np,center,sd,...)'",call.=FALSE)
+ stop("mif error: ",sQuote("particles")," must be a function of prototype ",sQuote("particles(Np,center,sd,...)"),call.=FALSE)
if (missing(start)) {
start <- coef(object)
if (length(start)==0)
- stop("mif error: 'start' must be specified",call.=FALSE)
+ stop("mif error: ",sQuote("start")," must be specified",call.=FALSE)
}
start.names <- names(start)
if (is.null(start.names))
- stop("mif error: 'start' must be a named vector",call.=FALSE)
+ stop("mif error: ",sQuote("start")," must be a named vector",call.=FALSE)
if (length(pars) == 0)
- stop("mif error: 'pars' must be a nonempty character vector",call.=FALSE)
+ stop("mif error: ",sQuote("pars")," must be a nonempty character vector",call.=FALSE)
if (
!is.character(pars) ||
!is.character(ivps) ||
@@ -66,7 +66,7 @@
any(pars%in%ivps) ||
any(ivps%in%pars)
)
- stop("mif error: 'pars' and 'ivps' must be mutually disjoint elements of 'names(start)'",call.=FALSE)
+ stop("mif error: ",sQuote("pars")," and ",sQuote("ivps")," must be mutually disjoint elements of ",sQuote("names(start)"),call.=FALSE)
Nv <- length(start)
if ((length(rw.sd)==1) && (rw.sd==0)) {
rw.sd <- rep(0,Nv)
@@ -74,7 +74,7 @@
}
rw.names <- names(rw.sd)
if (any(!(rw.names%in%start.names)))
- stop("mif error: all the names of 'rw.sd' must be names of 'start'",call.=FALSE)
+ stop("mif error: all the names of ",sQuote("rw.sd")," must be names of ",sQuote("start"),call.=FALSE)
if (any(rw.sd[c(pars,ivps)]==0)) {
zero.pars <- names(which(rw.sd[c(pars,ivps)]==0))
stop(
@@ -89,7 +89,7 @@
}
if (!all(c('Np','cooling.factor','ic.lag','var.factor')%in%names(alg.pars)))
stop(
- "mif error: 'alg.pars' must be a named list with elements 'Np','cooling.factor','ic.lag',and 'var.factor'",
+ "mif error: ",sQuote("alg.pars")," must be a named list with elements ",sQuote("Np"),",",sQuote("cooling.factor"),",",sQuote("ic.lag"),",and ",sQuote("var.factor"),
call.=FALSE
)
coef(object) <- start
@@ -149,10 +149,10 @@
names(sigma) <- names(start)
rw.names <- names(rw.sd)
if (!all(rw.names%in%names(start)))
- stop("mif error: all the names of 'rw.sd' must be names of 'start'",call.=FALSE)
+ stop("mif error: all the names of ",sQuote("rw.sd")," must be names of ",sQuote("start"),call.=FALSE)
sigma[rw.names] <- rw.sd
if (!all(c('Np','cooling.factor','ic.lag','var.factor')%in%names(alg.pars)))
- stop("mif error: 'alg.pars' must be a named list with elements 'Np','cooling.factor','ic.lag',and 'var.factor'",call.=FALSE)
+ stop("mif error: ",sQuote("alg.pars")," must be a named list with elements ",sQuote("Np"),",",sQuote("cooling.factor"),",",sQuote("ic.lag"),",and ",sQuote("var.factor"),call.=FALSE)
conv.rec <- matrix(NA,
nrow=Nmif+1,
ncol=length(theta)+2,
@@ -175,13 +175,13 @@
silent=FALSE
)
if (inherits(P,'try-error'))
- stop("mif error: error in 'particles'",call.=FALSE)
+ stop("mif error: error in ",sQuote("particles"),call.=FALSE)
X <- try(
init.state(object,params=P),
silent=FALSE
)
if (inherits(X,'try-error'))
- stop("mif error: error in 'init.state'",call.=FALSE)
+ stop("mif error: error in ",sQuote("init.state"),call.=FALSE)
x <- try(
pfilter(
as(object,'pomp'),
@@ -198,7 +198,7 @@
silent=FALSE
)
if (inherits(x,'try-error'))
- stop("mif error: error in 'pfilter'",call.=FALSE)
+ stop("mif error: error in ",sQuote("pfilter"),call.=FALSE)
v <- x$pred.var[pars,,drop=FALSE]
Modified: pkg/R/particles-mif.R
===================================================================
--- pkg/R/particles-mif.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/particles-mif.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -8,9 +8,9 @@
names(sd) <- names(center)
}
if (is.null(names(center)) || is.null(names(sd)))
- stop("particles error: 'center' and 'sd' must have names",call.=FALSE)
+ stop("particles error: ",sQuote("center")," and ",sQuote("sd")," must have names",call.=FALSE)
if (length(sd)!=length(center))
- stop("particles error: 'center' and 'sd' must be of equal length",call.=FALSE)
+ stop("particles error: ",sQuote("center")," and ",sQuote("sd")," must be of equal length",call.=FALSE)
x <- try(
do.call(
object at particles,
@@ -22,13 +22,13 @@
silent=FALSE
)
if (inherits(x,'try-error'))
- stop("particles error: error in user-specified 'particles' function",call.=FALSE)
+ stop("particles error: error in user-specified ",sQuote("particles")," function",call.=FALSE)
if (
!is.matrix(x) ||
Np!=ncol(x) ||
is.null(rownames(x))
)
- stop("particles error: user 'particles' function must return a matrix with Np columns and rownames",call.=FALSE)
+ stop("particles error: user ",sQuote("particles")," function must return a matrix with Np columns and rownames",call.=FALSE)
x
}
)
Modified: pkg/R/pfilter.R
===================================================================
--- pkg/R/pfilter.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/pfilter.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -13,7 +13,7 @@
if (length(object at params)>0) {
params <- object at params
} else {
- stop("pfilter error: 'params' must be supplied",call.=FALSE)
+ stop("pfilter error: ",sQuote("params")," must be supplied",call.=FALSE)
}
}
if (missing(Np))
@@ -33,7 +33,7 @@
npars <- nrow(params)
paramnames <- rownames(params)
if (is.null(paramnames))
- stop("pfilter error: 'params' must have rownames",call.=FALSE)
+ stop("pfilter error: ",sQuote("params")," must have rownames",call.=FALSE)
xstart <- init.state(object,params=params)
statenames <- rownames(xstart)
@@ -43,9 +43,9 @@
if (random.walk) {
rw.names <- names(.rw.sd)
if (is.null(rw.names)||!is.numeric(.rw.sd))
- stop("pfilter error: '.rw.sd' must be a named vector",call.=FALSE)
+ stop("pfilter error: ",sQuote(".rw.sd")," must be a named vector",call.=FALSE)
if (any(!(rw.names%in%paramnames)))
- stop("pfilter error: the rownames of 'params' must include all of the names of '.rw.sd'",call.=FALSE)
+ stop("pfilter error: the rownames of ",sQuote("params")," must include all of the names of ",sQuote(".rw.sd"),"",call.=FALSE)
sigma <- .rw.sd
}
@@ -121,16 +121,16 @@
problem.indices <- unique(which(!is.finite(x),arr.ind=TRUE)[,1])
if (length(problem.indices)>0) {
stop(
- "pfilter error: non-finite state variables ",
- paste(rownames(x)[problem.indices],collapse=','),
+ "pfilter error: non-finite state variable(s): ",
+ paste(rownames(x)[problem.indices],collapse=', '),
call.=FALSE
)
}
problem.indices <- unique(which(!is.finite(params),arr.ind=TRUE)[,1])
if (length(problem.indices)>0) {
stop(
- "pfilter error: non-finite parameters ",
- paste(rownames(params)[problem.indices],collapse=','),
+ "pfilter error: non-finite parameter(s): ",
+ paste(rownames(params)[problem.indices],collapse=', '),
call.=FALSE
)
}
Modified: pkg/R/plot-pomp.R
===================================================================
--- pkg/R/plot-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/plot-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -16,7 +16,7 @@
vars <- names(X)
tpos <- match("time",vars)
if (is.na(tpos))
- stop("'pomp' plot error: no data variable labeled 'time'",call.=FALSE)
+ stop(sQuote("pomp")," plot error: no data variable labeled ",sQuote("time"),call.=FALSE)
if (missing(variables))
vars <- vars[-tpos]
else
@@ -40,7 +40,7 @@
}
nser <- NCOL(x)
if (nser > 10)
- stop("'pomp' plot error: cannot plot more than 10 series as \"multiple\"",call.=FALSE)
+ stop(sQuote("pomp")," plot error: cannot plot more than 10 series as ",dQuote("multiple"),call.=FALSE)
if (is.null(main))
main <- xlabel
nm <- colnames(x)
Modified: pkg/R/pomp-methods.R
===================================================================
--- pkg/R/pomp-methods.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/pomp-methods.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -58,9 +58,9 @@
excl <- !(pars%in%names(object at params))
if (any(excl)) {
stop(
- "in 'coef': names '",
- paste(pars[excl],collapse=','),
- "' correspond to no parameters"
+ "in ",sQuote("coef"),": name(s) ",
+ paste(sapply(pars[excl],sQuote),collapse=','),
+ " correspond to no parameter(s)"
)
}
}
@@ -77,10 +77,10 @@
if (missing(pars)) {
pars <- names(value)
if (is.null(pars))
- stop("in 'coef<-': 'value' must be a named vector")
+ stop("in ",sQuote("coef<-"),": ",sQuote("value")," must be a named vector")
} else {
if (length(pars)!=length(value))
- stop("in 'coef<-': 'pars' and 'value' must be of the same length")
+ stop("in ",sQuote("coef<-"),": ",sQuote("pars")," and ",sQuote("value")," must be of the same length")
}
object at params <- as.numeric(value)
names(object at params) <- pars
@@ -88,19 +88,19 @@
if (missing(pars)) {
pars <- names(object at params)
if (is.null(pars))
- stop("bad 'pomp' object: slot 'params' should be a named vector")
+ stop("bad ",sQuote("pomp")," object: slot ",sQuote("params")," should be a named vector")
} else {
excl <- !(pars%in%names(object at params))
if (any(excl)) {
stop(
- "in 'coef<-': names '",
- paste(pars[excl],collapse=','),
- "' correspond to no parameters"
+ "in ",sQuote("coef<-"),": name(s) ",
+ paste(sapply(pars[excl],sQuote),collapse=','),
+ " correspond to no parameter(s)"
)
}
}
if (length(pars)!=length(value))
- stop("in 'coef<-': 'pars' and 'value' must be of the same length")
+ stop("in ",sQuote("coef<-"),": ",sQuote("pars")," and ",sQuote("value")," must be of the same length")
object at params[pars] <- as.numeric(value)
}
object
@@ -123,10 +123,10 @@
print(object)
cat("zero time, t0 = ",object at t0,"\n")
if (length(coef(object))>0) {
- cat("parameters:\n")
+ cat("parameter(s):\n")
print(coef(object))
} else {
- cat ("parameters unspecified\n");
+ cat ("parameter(s) unspecified\n");
}
cat("process model simulator, rprocess = \n")
print(object at rprocess)
Modified: pkg/R/pomp.R
===================================================================
--- pkg/R/pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -7,39 +7,39 @@
## check the data
if (is.data.frame(data)) {
if (!is.character(times) || length(times)!=1 || !(times%in%names(data)))
- stop("pomp error: 'times' must be the name of a column of 'data'")
+ stop("pomp error: ",sQuote("times")," must be the name of a column of ",sQuote("data"))
tmnm <- times
times <- data[[tmnm]]
data <- do.call(rbind,lapply(data[!(names(data)%in%tmnm)],as.numeric))
}
if (!is.numeric(data))
- stop("pomp error: 'data' must be numeric")
+ stop("pomp error: ",sQuote("data")," must be numeric")
if (!is.array(data))
data <- array(data,dim=c(1,length(data)),dimnames=list("data",NULL))
storage.mode(data) <- 'double'
## check times
if (!is.numeric(times) || !all(diff(times)>0))
- stop("pomp error: 'times' must be an increasing numeric vector")
+ stop("pomp error: ",sQuote("times")," must be an increasing numeric vector")
if (length(times)!=ncol(data))
- stop("pomp error: the length of 'times' does not equal the number of columns in 'data'")
+ stop("pomp error: the length of ",sQuote("times")," does not equal the number of columns in ",sQuote("data"))
storage.mode(times) <- 'double'
## check t0
if (!is.numeric(t0) || length(t0) > 1)
- stop("pomp error: the zero-time 't0' must be a single number")
+ stop("pomp error: the zero-time ",sQuote("t0")," must be a single number")
if (t0 > times[1])
- stop("pomp error: the zero-time 't0' must occur no later than the first observation")
+ stop("pomp error: the zero-time ",sQuote("t0")," must occur no later than the first observation")
storage.mode(t0) <- 'double'
if (missing(rprocess))
- rprocess <- function(xstart,times,params,...)stop("'rprocess' not specified")
+ rprocess <- function(xstart,times,params,...)stop(sQuote("rprocess")," not specified")
if (missing(dprocess))
- dprocess <- function(x,times,params,log=FALSE,...)stop("'dprocess' not specified")
+ dprocess <- function(x,times,params,log=FALSE,...)stop(sQuote("dprocess")," not specified")
if (!missing(measurement.model)) {
if (!(missing(dmeasure)&&missing(rmeasure))) {
- warning("specifying 'measurement.model' overrides specification of 'rmeasure' and 'dmeasure'")
+ warning("specifying ",sQuote("measurement.model")," overrides specification of ",sQuote("rmeasure")," and ",sQuote("dmeasure"))
}
mm <- measform2pomp(measurement.model)
rmeasure <- mm$rmeasure
@@ -47,17 +47,17 @@
}
if (missing(rmeasure))
- rmeasure <- function(x,t,params,covars,...)stop("'rmeasure' not specified")
+ rmeasure <- function(x,t,params,covars,...)stop(sQuote("rmeasure")," not specified")
if (missing(dmeasure))
- dmeasure <- function(y,x,t,params,log=FALSE,covars,...)stop("'dmeasure' not specified")
+ dmeasure <- function(y,x,t,params,log=FALSE,covars,...)stop(sQuote("dmeasure")," not specified")
if (missing(skeleton))
- skeleton <- function(x,t,params,covars,...)stop("'skeleton' not specified")
+ skeleton <- function(x,t,params,covars,...)stop(sQuote("skeleton")," not specified")
if (missing(initializer)) {
initializer <- function (params, t0, ...) {
ivpnames <- grep("\\.0$",names(params),val=TRUE)
if (length(ivpnames)<1)
- stop("default initializer error: no parameter names ending in '.0' found: see 'pomp' documentation")
+ stop("default initializer error: no parameter names ending in ",sQuote(".0")," found: see ",sQuote("pomp")," documentation")
x <- params[ivpnames]
names(x) <- sub("\\.0$","",ivpnames)
x
@@ -67,13 +67,13 @@
if (missing(PACKAGE)) PACKAGE <- character(0)
if (!is.function(rprocess))
- stop("pomp error: 'rprocess' must be a function")
+ stop("pomp error: ",sQuote("rprocess")," must be a function")
if (!is.function(dprocess))
- stop("pomp error: 'dprocess' must be a function")
+ stop("pomp error: ",sQuote("dprocess")," must be a function")
if (is.function(rmeasure)) {
if (!all(c('x','t','params','...')%in%names(formals(rmeasure))))
- stop("'rmeasure' must be a function of prototype 'rmeasure(x,t,params,...)'")
+ stop(sQuote("rmeasure")," must be a function of prototype ",sQuote("rmeasure(x,t,params,...)"))
rmeasure <- new(
"pomp.fun",
R.fun=rmeasure,
@@ -88,12 +88,12 @@
use=as.integer(2)
)
} else {
- stop("'rmeasure' must be either a function or the name of a compiled routine")
+ stop(sQuote("rmeasure")," must be either a function or the name of a compiled routine")
}
if (is.function(dmeasure)) {
if (!all(c('y','x','t','params','log','...')%in%names(formals(dmeasure))))
- stop("'dmeasure' must be a function of prototype 'dmeasure(y,x,t,params,log,...)'")
+ stop(sQuote("dmeasure")," must be a function of prototype ",sQuote("dmeasure(y,x,t,params,log,...)"))
dmeasure <- new(
"pomp.fun",
R.fun=dmeasure,
@@ -108,12 +108,12 @@
use=as.integer(2)
)
} else {
- stop("'dmeasure' must be either a function or the name of a compiled routine")
+ stop(sQuote("dmeasure")," must be either a function or the name of a compiled routine")
}
if (is.function(skeleton)) {
if (!all(c('x','t','params','...')%in%names(formals(skeleton))))
- stop("'skeleton' must be a function of prototype 'skeleton(x,t,params,...)'")
+ stop(sQuote("skeleton")," must be a function of prototype ",sQuote("skeleton(x,t,params,...)"))
skeleton <- new(
"pomp.fun",
R.fun=skeleton,
@@ -128,18 +128,18 @@
use=as.integer(2)
)
} else {
- stop("'skeleton' must be either a function or the name of a compiled routine")
+ stop(sQuote("skeleton")," must be either a function or the name of a compiled routine")
}
if (!is.function(initializer))
- stop("pomp error: 'initializer' must be a function")
+ stop("pomp error: ",sQuote("initializer")," must be a function")
if (!all(c('xstart','times','params','...')%in%names(formals(rprocess))))
- stop("pomp error: 'rprocess' must be a function of prototype 'rprocess(xstart,times,params,...)'")
+ stop("pomp error: ",sQuote("rprocess")," must be a function of prototype ",sQuote("rprocess(xstart,times,params,...)"))
if (!all(c('x','times','params','log','...')%in%names(formals(dprocess))))
- stop("pomp error: 'dprocess' must be a function of prototype 'dprocess(x,times,params,log,...)'")
+ stop("pomp error: ",sQuote("dprocess")," must be a function of prototype ",sQuote("dprocess(x,times,params,log,...)"))
if (!all(c('params','t0','...')%in%names(formals(initializer))))
- stop("pomp error: 'initializer' must be a function of prototype 'initializer(params,t0,...)'")
+ stop("pomp error: ",sQuote("initializer")," must be a function of prototype ",sQuote("initializer(params,t0,...)"))
if (missing(statenames)) statenames <- character(0)
if (missing(paramnames)) paramnames <- character(0)
@@ -150,7 +150,7 @@
tcovar <- numeric(0)
covarnames <- character(0)
} else if (missing(tcovar)) {
- stop("if 'covar' is supplied, 'tcovar' must be supplied also")
+ stop("if ",sQuote("covar")," is supplied, ",sQuote("tcovar")," must be supplied also")
} else if (is.data.frame(covar)) {
if (
(
@@ -165,7 +165,7 @@
!(tcovar%in%names(covar))
)
) {
- stop("if 'covar' is a data frame, 'tcovar' should indicate the time variable")
+ stop("if ",sQuote("covar")," is a data frame, ",sQuote("tcovar")," should indicate the time variable")
} else {
tcovar <- covar[[tcovar]]
covar <- as.matrix(covar[-tcovar])
@@ -175,12 +175,12 @@
}
if (length(tcovar)!=nrow(covar)) {
- stop("the length of 'tcovar' should match the number of rows of 'covar'")
+ stop("the length of ",sQuote("tcovar")," should match the number of rows of ",sQuote("covar"))
} else if (!all(covarnames%in%colnames(covar))) {
missing <- covarnames[!(covarnames%in%colnames(covar))]
- stop("covariate(s) ",paste(missing,collapse=",")," are not found among the columns of 'covar'")
+ stop("covariate(s) ",paste(missing,collapse=",")," are not found among the columns of ",sQuote("covar"))
} else if (!is.numeric(tcovar)) {
- stop("'tcovar' must either be a numeric vector or must name a numeric vector in the data frame 'covar'")
+ stop(sQuote("tcovar")," must either be a numeric vector or must name a numeric vector in the data frame ",sQuote("covar"))
}
if (nrow(covar)>0) {
@@ -188,17 +188,17 @@
(skeleton at use==1)
&&!("covars"%in%names(formals(skeleton at R.fun)))
)
- warning("a covariate table has been given, yet the 'skeleton' function does not have 'covars' as a formal argument")
+ warning("a covariate table has been given, yet the ",sQuote("skeleton")," function does not have ",sQuote("covars")," as a formal argument")
if (
(rmeasure at use==1)
&&!("covars"%in%names(formals(rmeasure at R.fun)))
)
- warning("a covariate table has been given, yet the 'rmeasure' function does not have 'covars' as a formal argument")
+ warning("a covariate table has been given, yet the ",sQuote("rmeasure")," function does not have ",sQuote("covars")," as a formal argument")
if (
(dmeasure at use==1)
&&!("covars"%in%names(formals(dmeasure at R.fun)))
)
- warning("a covariate table has been given, yet the 'dmeasure' function does not have 'covars' as a formal argument")
+ warning("a covariate table has been given, yet the ",sQuote("dmeasure")," function does not have ",sQuote("covars")," as a formal argument")
}
new(
@@ -230,7 +230,7 @@
stop("you must provide at least one formula")
for (k in 1:nobs) {
if (!inherits(formulae[[k]],"formula"))
- stop("'measurement.model' takes formulae as arguments")
+ stop(sQuote("measurement.model")," takes formulae as arguments")
}
obsnames <- unlist(lapply(formulae,function(x)x[[2]]))
distrib <- lapply(formulae,function(x)as.character(x[[3]][[1]]))
Modified: pkg/R/rmeasure-pomp.R
===================================================================
--- pkg/R/rmeasure-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/rmeasure-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -8,7 +8,7 @@
silent=FALSE
)
if (inherits(val,'try-error'))
- stop("rmeasure error: error in user 'rmeasure'",call.=FALSE)
+ stop("rmeasure error: error in user ",sQuote("rmeasure"),call.=FALSE)
val
}
)
Modified: pkg/R/rprocess-pomp.R
===================================================================
--- pkg/R/rprocess-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/rprocess-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -8,7 +8,7 @@
silent=FALSE
)
if (inherits(x,'try-error'))
- stop("rprocess error: error in user 'rprocess'",call.=FALSE)
+ stop("rprocess error: error in user ",sQuote("rprocess"),call.=FALSE)
x
}
)
Modified: pkg/R/simulate-pomp.R
===================================================================
--- pkg/R/simulate-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/simulate-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -9,12 +9,12 @@
ntimes <- length(times)
times <- as.numeric(times)
if (ntimes<1)
- stop("if length of 'times' is less than 1, there is no work to do",call.=FALSE)
+ stop("if length of ",sQuote("times")," is less than 1, there is no work to do",call.=FALSE)
if (missing(params)) {
if (length(object at params)>0)
params <- object at params
else
- stop("no 'params' specified",call.=FALSE)
+ stop("no ",sQuote("params")," specified",call.=FALSE)
}
if (is.null(dim(params)))
params <- matrix(params,ncol=1,dimnames=list(names(params),NULL))
Modified: pkg/R/skeleton-pomp.R
===================================================================
--- pkg/R/skeleton-pomp.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/skeleton-pomp.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -8,7 +8,7 @@
silent=FALSE
)
if (inherits(x,'try-error'))
- stop("skeleton error: error in user 'skeleton'",call.=FALSE)
+ stop("skeleton error: error in user ",sQuote("skeleton"),call.=FALSE)
x
}
)
Modified: pkg/R/sobol.R
===================================================================
--- pkg/R/sobol.R 2008-07-25 09:05:50 UTC (rev 11)
+++ pkg/R/sobol.R 2008-07-25 09:27:06 UTC (rev 12)
@@ -1,8 +1,8 @@
sobol <- function (vars, n) {
if (!is.list(vars) || is.null(names(vars)))
- stop("sobol error: 'vars' must be a named list")
+ stop("sobol error: ",sQuote("vars")," must be a named list")
if (!all(sapply(vars,function(x)is.numeric(x)&&(length(x)==2))))
- stop("sobol error: each entry in 'vars' must specify a range")
+ stop("sobol error: each entry in ",sQuote("vars")," must specify a range")
d <- length(vars)
x <- .Call("sobol_sequence",as.integer(c(d,n)))
y <- sapply(
More information about the pomp-commits
mailing list