GrafItemCom3: Sum of vector elements.

View source: R/old/GrafItemCom3.R

GrafItemCom3R Documentation

Sum of vector elements.

Description

sum returns the sum of all the values present in its arguments.

Usage

GrafItemCom3(
  dirgrf,
  nomgrf,
  anos,
  gabitem,
  itcom1,
  param1,
  rj1,
  percpr1,
  itcom2,
  param2,
  rj2,
  percpr2,
  ger,
  geral
)

Arguments

...

Numeric, complex, or logical vectors.

na.rm

A logical scalar. Should missing values (including NaN) be removed?

Details

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.

Value

If all inputs are integer and logical, then the output will be an integer. If integer overflow http://en.wikipedia.org/wiki/Integer_overflow occurs, the output will be NA with a warning. Otherwise it will be a length-one numeric or complex vector.

Zero-length vectors have sum 0 by definition. See http://en.wikipedia.org/wiki/Empty_sum for more details.

Examples

sum(1:10)
sum(1:5, 6:10)
sum(F, F, F, T, T)

sum(.Machine$integer.max, 1L)
sum(.Machine$integer.max, 1)

## Not run: 
sum("a")

## End(Not run)

leandromarino/CesgTools documentation built on May 25, 2022, 5:03 a.m.