[Mboost-commits] r849 - pkg/mboostDevel/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 22 14:35:21 CEST 2015


Author: hofner
Date: 2015-04-22 14:35:20 +0200 (Wed, 22 Apr 2015)
New Revision: 849

Modified:
   pkg/mboostDevel/R/bl.R
Log:
(bl_lin) better error messages

Modified: pkg/mboostDevel/R/bl.R
===================================================================
--- pkg/mboostDevel/R/bl.R	2015-04-15 15:40:50 UTC (rev 848)
+++ pkg/mboostDevel/R/bl.R	2015-04-22 12:35:20 UTC (rev 849)
@@ -659,8 +659,13 @@
 
     newX <- function(newdata = NULL) {
         if (!is.null(newdata)) {
-            stopifnot(all(names(blg) %in% names(newdata)))
-            stopifnot(all(class(newdata) == class(mf)))
+            if (!all(names(blg) %in% names(newdata)))
+                stop("Variable(s) missing in ", sQuote("newdata"), ":\n\t",
+                     names(blg)[!names(blg) %in% names(newdata)])
+            if (!all(class(newdata) == class(mf)))
+                stop(sQuote("newdata"),
+                     " must have the same class as the original data:\n\t",
+                     class(mf))
             nm <- names(blg)
             if (any(duplicated(nm)))  ## removes duplicates
                 nm <- unique(nm)



More information about the Mboost-commits mailing list