[R] Help with dummy.coef

James M. Curran j.curran at auckland.ac.nz
Wed May 5 06:56:45 CEST 2010


Hi all,

I've been revising some lecture notes and I have something that used to 
work with dummy.coef and now doesn't. A search of R help doesn't reveal 
any recent discussion on this function, so I'd appreciate your thoughts. 
The (compact/relevant) code is below, and complains at the line 
rep.int(x1[[i]][1L], nl), levels = xl[[i]]) that the 'times' value is 
invalid. This seems to relate to the the polynomial terms, but I'm not 
sure how to take it further than that.


battery.df = data.frame(
            voltage = c(130,155,74,180,34,40,80,75,20,70,82,
   58,150,188,159,126,136,122,106,115,25,70,58,45,
   138,110,168,160,174,130,150,139,96,104,82,60),
           material = factor(rep(1:3,rep(12,3))),
             temp = rep(rep(c(50,65,80),rep(4,3)),3))

battery.df = data.frame(voltage, material, temp)
battery.fit=lm(voltage~material*(temp+I(temp^2)),data = battery.df)


dummy.coef(battery.fit)

Error in rep.int(xl[[i]][1L], nl) : invalid 'times' value


Thanks,
James

-- 
James M. Curran, Ph.D.
Associate Professor
Director Bioinformatics Institute
Department of Statistics
Faculty of Science
Private Bag 92019
Auckland
New Zealand



More information about the R-help mailing list