prod                  package:base                  R Documentation

_P_r_o_d_u_c_t _o_f _V_e_c_t_o_r _E_l_e_m_e_n_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     'prod' returns the product of all the values present in its
     arguments.

_U_s_a_g_e:

     prod(..., na.rm = FALSE)

_A_r_g_u_m_e_n_t_s:

     ...: numeric or complex or logical vectors.

   na.rm: logical.  Should missing values be removed?

_D_e_t_a_i_l_s:

     If 'na.rm' is 'FALSE' an 'NA' value in any of the arguments will
     cause a value of 'NA' to be returned, otherwise 'NA' values are
     ignored.

     This is a generic function: methods can be defined for it directly
     or via the 'Summary' group generic. For this to work properly, the
     arguments '...' should be unnamed, and dispatch is on the first
     argument.

     Logical true values are regarded as one, false values as zero. For
     historical reasons, 'NULL' is accepted and treated as if it were
     'numeric(0)'.

_V_a_l_u_e:

     The product, a numeric (of type '"double"') or complex vector of
     length one. *NB:* the product of an empty set is one, by
     definition.

_S_4 _m_e_t_h_o_d_s:

     This is part of the S4 'Summary' group generic.  Methods for it
     must use the signature 'x, ..., na.rm'.

_R_e_f_e_r_e_n_c_e_s:

     Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S
     Language_. Wadsworth & Brooks/Cole.

_S_e_e _A_l_s_o:

     'sum', 'cumprod', 'cumsum'.

_E_x_a_m_p_l_e_s:

     print(prod(1:7)) == print(gamma(8))

