sum(..., na.rm=F) prod(..., na.rm=F)
NAs) are allowed, but will cause the value returned
to be
NA, unless
na.rm=TRUE.
na.rm= form.
sum returns
0
and
prod returns
1.
These functions are members of the
Summary group of generic functions.
The
sum function performs integer arithmetic if all
of the numbers are considered integers.
If overflow occurs, integer arithmetic "wraps around" rather than producing
an error or an
NA. For example,
sum(as.integer(c(2147483647,34)))
returns
-2147483615.
geo.mean <- function(x) prod(x)^(1/length(x)) sum(1:4)