[R] multiply for vector in R

ecatchpole e.catchpole at adfa.edu.au
Wed Oct 24 09:43:33 CEST 2007


Guolian Kang wrote on 10/24/2007 01:37 PM:
> Dear All,
>
> Is there a conmand to calculate the multiplication of the elements in a vector? For example:
>
> a=c(1,2,3,4)
> I want to get 1*2*3*4=24. 
> Because the dimension of the vector is high, I want to know there is a command for this task in R?
>
> Thank you so much!
>
> Kang
>
>   

?prod

Ted.

-- 
 Dr E.A. Catchpole  
 Visiting Fellow
 Univ of New South Wales at ADFA, Canberra, Australia
    _	  and University of Kent, Canterbury, England
   'v'	  - www.pems.adfa.edu.au/~ecatchpole          
  /   \	  - fax: +61 2 6268 8786		   
   m m    - ph:  +61 2 6268 8895



More information about the R-help mailing list