[R] product of vector elements

Gabor Grothendieck ggrothendieck at gmail.com
Sun Jan 13 01:55:43 CET 2008


help.search("product")

On Jan 12, 2008 7:38 PM, Gerard Smits <g_smits at verizon.net> wrote:
> All,
>
> I would like to find a simper method that I now have to find the
> product of all elements  in a vector:
>
> #get product of vector elements: (1,2,3,4,5)
> vec.product <- exp(sum(log(c(1,2,3,4,5))))
>
> I have not found a vector product function, if one has been written.
>
> Thanks,
>
> Gerard
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list