Bug 14638

Summary: Wishlist: pmin/pmax silently recycle ragged input
Product: R Reporter: Richard Bourgon <rbourgon>
Component: WishlistAssignee: R-core <R-core>
Status: CLOSED WISHLIST    
Severity: minor    
Priority: P5    
Version: R 2.13.0   
Hardware: ix86 (32-bit)   
OS: Mac OS X v10.6   

Description Richard Bourgon 2011-07-22 21:50:09 UTC
Recycling when one vector's length does not evenly divide into the other's is usually unintended. Most code throws a warning or an error:

  > 1:3 + 1:2
  [1] 2 4 4
  Warning message: 
  In 1:3 + 1:2 :
    longer object length is not a multiple of shorter object length

  > data.frame(a = 1:3, b = 1:2)
  Error in data.frame(a = 1:3, b = 1:2) : 
    arguments imply differing number of rows: 3, 2

The pmin() and pmax() functions recycle silently in such cases:

  > pmin(1:3, 1:2)
  [1] 1 2 1

It would be nice to get a warning here.
Comment 1 Brian Ripley 2011-07-27 20:34:54 UTC
This is not a bug.  Wishes should be marked as such (see the R FAQ).
Comment 2 Brian Ripley 2011-09-04 14:02:41 UTC
fulfilled for 2.14.0