Learn R Programming

DescTools (version 0.99.56)

DigitSum: Calculate Digit Sum

Description

Calculate digit sum of a number x.

Usage

DigitSum(x)

Value

the digit sum

Arguments

x

an integer number

Author

Andri Signorell <andri@signorell.net> based on code by Julius benchmarked by Uwe

References

URL: https://stackoverflow.com/questions/18675285/digit-sum-function-in-r

See Also

IsPrime

Examples

Run this code
DigitSum(c(124, 45, 268))
# [1]  7  9 16

Run the code above in your browser using DataLab