[Rd] pmax loses row names (PR#2357)

hosking@watson.ibm.com hosking@watson.ibm.com
Mon Dec 9 16:57:11 2002


Full_Name: J. R. M. Hosking
Version: 1.5
OS: Win2000
Submission from: (NULL) (198.81.209.17)


Documentation for pmax says "`attributes' (such as `names' or `dim') are
transferred from the first argument (if applicable)".  But:

> a<-matrix(c(1,2,3,-1,-2,3),2,3,dimnames=list(c("A","B"),NULL))
> a
  [,1] [,2] [,3]
A    1    3   -2
B    2   -1    3
> pmax(a,0)
     [,1] [,2] [,3]
[1,]    1    3    0
[2,]    2    0    3
 
The row names have been lost.  This doesn't happen with column names, and it
doesn't happen in S-plus, so it looks like a bug.