# works as expected> ac <- c('A','B'); > identical(ac,ac[1:2])[1] TRUE #but> af <- factor(ac) > identical(af,af[1:2])[1] FALSE Any opinions? Jonathan Swinton, Statistical Scientist, Computational Biology, Pathway Analysis, Global Sciences and Information, AstraZeneca
"Swinton, Jonathan" <Jonathan.Swinton at astrazeneca.com> writes:> # works as expected > > ac <- c('A','B'); > > identical(ac,ac[1:2]) > [1] TRUE > > #but > > af <- factor(ac) > > identical(af,af[1:2]) > [1] FALSE > > Any opinions?Hmm, surprising indeed. The proximate cause would seem to be that> names(attributes(af))[1] "levels" "class"> names(attributes(af[1:2]))[1] "class" "levels" -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907