Displaying 2 results from an estimated 2 matches for "doselin".
2007 May 01
1
Levels attribute in integer columns created by model.frame()
...natory variable that has been derived as an unclassed
factor. (Ross Darnell drew this to my attention.)
## Data are slightly modified from p.191 of MASS
> worms <- data.frame(sex=gl(2,6), Dose=factor(rep(2^(0:5),2)),
+ deaths=c(1,4,9,13,18,20,0,2,6,10,12,16))
> worms$doselin <- unclass(worms$Dose)
> class(worms$doselin)
[1] "integer"
> attributes(worms$doselin)
$levels
[1] "1" "2" "4" "8" "16" "32"
> worms.glm <- glm(cbind(deaths, (20-deaths)) ~ sex+ doselin,
+...
2007 May 01
0
[Fwd: Re: [R-downunder] Beware unclass(factor)] (PR#9641)
...-UQ-FilterTime: 1177925201
> X-Scanned-By: MIMEDefang 2.58 on UQ Mailhub on 130.102.149.131
> References: <46359373.50504 at uq.edu.au>
> Original-recipient: rfc822;r.darnell at uq.edu.au
>
> Observe the following
>
> > z <- model.frame(cbind(moths,(20-moths)) ~sex+ doselin,data=worms)
> > class(z$doselin)
> [1] "other"
> > levels(z$doselin)
> [1] "1" "2" "4" "8" "16" "32"
> > attributes(z$doselin)
> $levels
> [1] "1" "2" "4" "8...