[R] bug in dummy.coef?

Alexandra Kuznetsova alku at dtu.dk
Thu Oct 24 22:25:55 CEST 2013



Dear all,

Running the following code produces an error in dummy.coef. I guess it might be a bug..
> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2, 10, 20, labels = c("Ctl","Trt"))
> weight <- c(ctl, trt)
> x <- rnorm(length(weight))
> lm.D9 <- lm(weight ~ group + x + I(x^2))
> dummy.coef(lm.D9)
Error in rep.int(xl[[i]][1L], nl) : invalid 'times' value

> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=Danish_Denmark.1252  LC_CTYPE=Danish_Denmark.1252    LC_MONETARY=Danish_Denmark.1252
[4] LC_NUMERIC=C                    LC_TIME=Danish_Denmark.1252

attached base packages:
[1] parallel  splines   stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
 [1] pbkrtest_0.3-5    MASS_7.3-26       Hmisc_3.12-2      Formula_1.1-1     survival_2.37-4   numDeriv_2012.9-1
 [7] lmerTest_2.0-1    lme4_1.1-1        Matrix_1.0-12     lattice_0.20-15

loaded via a namespace (and not attached):
[1] cluster_1.14.4 gdata_2.13.2   gplots_2.11.3  grid_3.0.1     gtools_3.0.0   minqa_1.2.1    nlme_3.1-109
[8] rpart_4.1-1    tools_3.0.1


With best wishes,
Alexandra


________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] on behalf of Alexandra Kuznetsova [alku at dtu.dk]
Sent: Thursday, October 24, 2013 10:51 AM
To: r-help at r-project.org
Subject: [R] bug in dummy.coef?

Dear all,

Running the following code produces an error in dummy.coef. I guess it might be a bug..

> ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14)
> trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69)
> group <- gl(2, 10, 20, labels = c("Ctl","Trt"))
> weight <- c(ctl, trt)
> x <- rnorm(length(weight))
> lm.D9 <- lm(weight ~ group + x + I(x^2))
> dummy.coef(lm.D9)
Error in rep.int(xl[[i]][1L], nl) : invalid 'times' value



> sessionInfo()

R version 3.0.1 (2013-05-16)

Platform: x86_64-w64-mingw32/x64 (64-bit)



locale:

[1] LC_COLLATE=Danish_Denmark.1252  LC_CTYPE=Danish_Denmark.1252    LC_MONETARY=Danish_Denmark.1252

[4] LC_NUMERIC=C                    LC_TIME=Danish_Denmark.1252



attached base packages:

[1] parallel  splines   stats     graphics  grDevices utils     datasets  methods   base



other attached packages:

 [1] pbkrtest_0.3-5    MASS_7.3-26       Hmisc_3.12-2      Formula_1.1-1     survival_2.37-4   numDeriv_2012.9-1

 [7] lmerTest_2.0-1    lme4_1.1-1        Matrix_1.0-12     lattice_0.20-15



loaded via a namespace (and not attached):

[1] cluster_1.14.4 gdata_2.13.2   gplots_2.11.3  grid_3.0.1     gtools_3.0.0   minqa_1.2.1    nlme_3.1-109

[8] rpart_4.1-1    tools_3.0.1




With best wishes,
Alexandra

        [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list