[Rcpp-commits] r1242 - pkg/RcppArmadillo/inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 14 05:48:29 CEST 2010
Author: edd
Date: 2010-05-14 05:48:28 +0200 (Fri, 14 May 2010)
New Revision: 1242
Modified:
pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
Log:
additional unit test for formula interface
Modified: pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
===================================================================
--- pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-05-14 02:16:27 UTC (rev 1241)
+++ pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-05-14 03:48:28 UTC (rev 1242)
@@ -76,13 +76,23 @@
data(trees)
flm <- .Call("fastLm",
log(trees$Volume),
- cbind(rep(1,31), log(trees$Girth)),
+ cbind(1, log(trees$Girth)),
PACKAGE="RcppArmadillo")
fit <- lm(log(Volume) ~ log(Girth), data=trees)
- checkEquals( as.numeric(flm$coef), as.numeric(coef(fit)),
+ checkEquals( as.numeric(flm$coefficients), as.numeric(coef(fit)),
msg="fastLm.coef")
checkEquals( as.numeric(flm$stderr), as.numeric(coef(summary(fit))[,2]),
msg="fastLm.stderr")
}
+test.fastLmFormula <- function() {
+ data(trees)
+ flm <- fastLm(log(Volume) ~ log(Girth), data=trees)
+ fit <- lm(log(Volume) ~ log(Girth), data=trees)
+
+ checkEquals(flm$coef, coef(fit), msg="fastLm.coef")
+ checkEquals(as.numeric(flm$stderr), as.numeric(coef(summary(fit))[,2]),
+ msg="fastLm.stderr")
+}
+
More information about the Rcpp-commits
mailing list