[Rd] aperm doesn't copy attributes
Liaw, Andy
andy_liaw at merck.com
Thu Sep 20 14:55:08 CEST 2007
In the "Value" section of ?aperm, I see:
`... In each case other attributes are copied from a.'
However:
R> f <- factor(sample(letters[1:2], 10, replace=TRUE))
R> dim(f) <- c(5, 2)
R> t(f)
[,1] [,2] [,3] [,4] [,5]
[1,] a a b b b
[2,] a a b a a
Levels: a b
R> aperm(f, c(2, 1))
[,1] [,2] [,3] [,4] [,5]
[1,] 1 1 2 2 2
[2,] 1 1 2 1 1
Examining attributes() of the above shows that the result from aperm
only retained the dim attribute.
Does this qualify as a bug?
R> sessionInfo()
R version 2.6.0 beta (2007-09-18 r42895)
i386-pc-mingw32
locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
--
Andy Liaw, PhD
Biometrics Research PO Box 2000 RY33-300
Merck Research Labs Rahway, NJ 07065
andy_liaw(a)merck.com 732-594-0820
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments,...{{dropped}}
More information about the R-devel
mailing list