Re: [R] Applying min to numeric vectors

2008-12-09 Thread Jorge Ivan Velez
Dear Brigid, Try: pmin(a,b) HTH, Jorge On Tue, Dec 9, 2008 at 11:58 AM, Brigid Mooney <[EMAIL PROTECTED]> wrote: > I was surprised this morning, that it seems as though the min() function > does not work as *I* anticipated when given vector arguments. > > For example: > a <- 1:10 > b <- c(r

Re: [R] Applying min to numeric vectors

2008-12-09 Thread Henrique Dallazuanna
Try this: pmin(a, b) On Tue, Dec 9, 2008 at 2:58 PM, Brigid Mooney <[EMAIL PROTECTED]> wrote: > I was surprised this morning, that it seems as though the min() function > does not work as *I* anticipated when given vector arguments. > > For example: > a <- 1:10 > b <- c(rep(1, times=5), rep(10,

[R] Applying min to numeric vectors

2008-12-09 Thread Brigid Mooney
I was surprised this morning, that it seems as though the min() function does not work as *I* anticipated when given vector arguments. For example: a <- 1:10 b <- c(rep(1, times=5), rep(10, times=5)) Result: > min(a,b) 1 What I actually wanted was a term by term minimum, i.e.: ifelse(a<=b, a, b