X-Git-Url: https://git.auder.net/?p=talweg.git;a=blobdiff_plain;f=R%2FgetForecast.R;h=c07be7c6df367c0ca782e6b279b8ca7926254c5b;hp=fde8e4501deb934929d43331196f005ecdef50d2;hb=e5aa669afc0b71278d1a864fb0d4e2aff8032ef1;hpb=e030a6e31232332b73187eda25870e843152c174 diff --git a/R/getForecast.R b/R/getForecast.R index fde8e45..c07be7c 100644 --- a/R/getForecast.R +++ b/R/getForecast.R @@ -37,7 +37,7 @@ #' #do_something_with_pred #' }} #' @export -getForecast = function(data, indices, forecaster, pjump, +getForecast = function(data, indices, forecaster, pjump=NULL, memory=Inf, horizon=data$getStdHorizon(), ...) { # (basic) Arguments sanity checks @@ -48,12 +48,16 @@ getForecast = function(data, indices, forecaster, pjump, if (any(indices<=0 | indices>data$getSize())) stop("Indices out of range") indices = sapply(indices, dateIndexToInteger, data) - if (!is.character(forecaster) || !is.character(pjump)) - stop("forecaster and pjump should be of class character") + if (!is.character(forecaster)) + stop("forecaster (name) should be of class character") #pjump could be NULL pred = list() forecaster = new(paste(forecaster,"Forecaster",sep=""), data=data, - pjump = getFromNamespace(paste("get",pjump,"JumpPredict",sep=""), "talweg")) + pjump = + if (is.null(pjump)) + function() {} + else + getFromNamespace(paste("get",pjump,"JumpPredict",sep=""), "talweg")) for (today in indices) { pred[[length(pred)+1]] = list(