[Rd] dimnames returned by function apply
Fischer, Bernd
b.fischer at dkfz-heidelberg.de
Wed Apr 29 20:22:44 CEST 2015
Dear all,
I noticed that the dimnames returned by apply are different in the new release.
In the following example. The returned row-names are c(“S”,”T”), but shouldn’t they be c(“X”,”Y”) as in the old release?
Best,
Bernd
>X = array(1:8, dim=c(4,2))
>dimnames(X) = list(c("A","B","C","D"),c("S","T"))
>apply(X, 1, function(x) { c(X=x[1]*5,Y=x[2]*5) } )
A B C D
S 5 10 15 20
T 25 30 35 40
> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin14.3.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)
locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
More information about the R-devel
mailing list