[Rcpp-commits] r3698 - in pkg: RcppArmadillo/R RcppEigen/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jul 19 02:32:00 CEST 2012


Author: edd
Date: 2012-07-19 02:31:59 +0200 (Thu, 19 Jul 2012)
New Revision: 3698

Modified:
   pkg/RcppArmadillo/R/fastLm.R
   pkg/RcppEigen/R/fastLm.R
Log:
 o improved test for intercept once more with a tip of the hat to Doug


Modified: pkg/RcppArmadillo/R/fastLm.R
===================================================================
--- pkg/RcppArmadillo/R/fastLm.R	2012-07-18 14:00:40 UTC (rev 3697)
+++ pkg/RcppArmadillo/R/fastLm.R	2012-07-19 00:31:59 UTC (rev 3698)
@@ -42,7 +42,7 @@
     res$fitted.values <- as.vector(X %*% res$coefficients)
     res$residuals <- y - res$fitted.values
     res$call <- match.call()
-    res$intercept <- any(apply(X, 2, function(x) all(x == 1)))
+    res$intercept <- any(apply(X, 2, function(x) all(x == x[1])))
 
     class(res) <- "fastLm"
     res

Modified: pkg/RcppEigen/R/fastLm.R
===================================================================
--- pkg/RcppEigen/R/fastLm.R	2012-07-18 14:00:40 UTC (rev 3697)
+++ pkg/RcppEigen/R/fastLm.R	2012-07-19 00:31:59 UTC (rev 3698)
@@ -33,7 +33,7 @@
 
     res <- fastLmPure(X, y, as.integer(method[1]))
     res$call <- match.call()
-    res$intercept <- any(apply(X, 2, function(x) all(x == 1)))
+    res$intercept <- any(apply(X, 2, function(x) all(x == x[1])))
 
     class(res) <- "fastLm"
     res



More information about the Rcpp-commits mailing list