sum: Sum

View source: R/sum.R

sumR Documentation

Sum

Description

Returns the arithmetic sum of the inputs.

Details

Setting na.rm = TRUE will remove NA's before calculating the sum of the values.

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

See Also

summarize(), mean()

Examples

sum(c(1, 2, 3))
#> [1] 6

-----------------------------------

library(gapminder)

gapminder %>%
  filter(year == 2007) %>%
  group_by(continent) %>%
  summarize(pop_total = sum(pop))

#> # A tibble: 5 x 2
#>   continent  pop_total
     <fct>          <dbl>
#> 1 Africa     929539692
#> 2 Americas   898871184
#> 3 Asia      3811953827
#> 4 Europe     586098529
#> 5 Oceania     24549947


cobriant/qelp documentation built on July 1, 2022, 7:24 a.m.