[R] like apply(x,1,sum), but using multiplication?

2007-05-07 Thread Jose Quesada
Hi, I need to multiply all columns in a matrix so something like apply(x,2,sum), but using multiplication should do. I have tried apply(x,2,*) I know this must be trivial, but I get: Error in FUN(newX[, i], ...) : invalid unary operator The help for apply states that unary operators must be

Re: [R] like apply(x,1,sum), but using multiplication?

2007-05-07 Thread Henrique Dallazuanna
Try: apply(x, 2, prod) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 Ohttp://maps.google.com/maps?f=qhl=enq=Curitiba,+Brazillayer=ie=UTF8z=18ll=-25.448315,-49.276916spn=0.002054,0.005407t=kom=1 On 07/05/07, Jose Quesada [EMAIL PROTECTED] wrote: Hi, I need to

Re: [R] like apply(x,1,sum), but using multiplication?

2007-05-07 Thread Benilton Carvalho
see ?prod b On May 7, 2007, at 2:25 PM, Jose Quesada wrote: Hi, I need to multiply all columns in a matrix so something like apply(x,2,sum), but using multiplication should do. I have tried apply(x,2,*) I know this must be trivial, but I get: Error in FUN(newX[, i], ...) : invalid unary

Re: [R] like apply(x,1,sum), but using multiplication?

2007-05-07 Thread Sundar Dorai-Raj
Jose Quesada said the following on 5/7/2007 11:25 AM: Hi, I need to multiply all columns in a matrix so something like apply(x,2,sum), but using multiplication should do. I have tried apply(x,2,*) I know this must be trivial, but I get: Error in FUN(newX[, i], ...) : invalid unary