[Rd] dimnames returned by function apply
Martin Maechler
maechler at ion-3.math.ethz.ch
Thu Apr 30 23:39:48 CEST 2015
>>>>> Martin Maechler <maechler at lynne.stat.math.ethz.ch>
>>>>> on Thu, 30 Apr 2015 18:23:58 +0200 writes:
>>>>> Fischer, Bernd <b.fischer at dkfz-heidelberg.de>
>>>>> on Wed, 29 Apr 2015 20:22:44 +0200 writes:
>> 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?
> Not quite : They were c("X.S", "Y.T")
> Still
[............]
> Congratulations on your finding the first "bad" bug in R
> 3.2.0 ! "bad": a true regression, i.e., a bug not present
> in earlier versions of R.
> I'm almost sure it is my fault, and I'm going to look into
> fixing it!
Fix committed to R-devel and R-patched, svn revision
68282 and 68283, respectively.
So if you get R 3.2.0 patched in a day or so, you'll get a
version of apply() which behaves as previously in this case.
Martin Maechler
> For the curious ones: It was introduced with the following
> new feature (which implied fixing apply()'s treatment of
> named dimnames):
> • apply(m, 2, identity) is now the same as the matrix
> m when it has _named_ row names.
>> Best, Bernd
> Thank you, Bernd, for the report!
> Martin Maechler, ETH Zurich
>>> 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)
> [...........]
More information about the R-devel
mailing list