triangle_num: nth Triangle Number (like factorial but with addition)

View source: R/specific_calculations.R

triangle_numR Documentation

nth Triangle Number (like factorial but with addition)

Description

nth Triangle Number (like factorial but with addition)

Usage

triangle_num(nums, coerce = round, ...)

Arguments

nums

(Numeric) A vector of numbers.

coerce

(Name/Symbol) The name of a function that will be used to coerce nums into integers, e.g. round or ceiling or floor.

...

(dots) Extra arguments sent to the function named in coerce.

Value

A Numeric vector where each element is the nth triangle number of the original element.

Authors

Source

https://math.stackexchange.com/a/60581

Examples

triangle_num(1:10)

#>  [1]  1  3  6 10 15 21 28 36 45 55


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.