From 56974e5c86c331d84d62acc42927d706fc003f82 Mon Sep 17 00:00:00 2001 From: Wesley Burr Date: Mon, 14 May 2018 22:20:03 -0400 Subject: [PATCH] Fixes S3 predict function Changes ~ 2 years ago to holstius/CALINE3 mean that CALINE3_RECEPTOR_TOTALS does not exist anymore; only CAL3RXM and CAL3RXL are possible targets for the do.call() via the CALINE3 package. Thus, running the San Francisco vignette dies on the do.call() in the predict() line. This adds a parameter to the predict function, defaulting to CAL3RXL, which allows the prediction to function, while still allowing the user to select between RXL and RXM models. --- R/S3-Caline3Model.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/S3-Caline3Model.R b/R/S3-Caline3Model.R index 68b6073..59ec909 100644 --- a/R/S3-Caline3Model.R +++ b/R/S3-Caline3Model.R @@ -121,7 +121,7 @@ terrain.default <- function(model, ...) model$terrain #' @method predict Caline3Model #' @importFrom stats predict #' @export -predict.Caline3Model <- function (object, max_dist = 3000, units = "ppm") { +predict.Caline3Model <- function (object, max_dist = 3000, units = "ppm", CAL_MODEL = "CAL3RXL") { stopifnot(inherits(object, 'Caline3Model')) lnk <- links(object) @@ -160,7 +160,7 @@ predict.Caline3Model <- function (object, max_dist = 3000, units = "ppm") { LXR = LXR) all_args <- c(rcp_args, lnk_args, met_args, aux_args) - C <- do.call("CALINE3_RECEPTOR_TOTALS", all_args) + C <- do.call(CAL_MODEL, all_args) # Assign the computed estimates back to the matrix require(testthat)