R: Calculate Digit Sum

DigitSum {DescTools} | R Documentation

## Calculate Digit Sum

### Description

Calculate digit sum of a number x.

### Usage

    DigitSum(x)

### Arguments

`x` | an integer number

### Value

the digit sum

### Author(s)

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

### References

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

### See Also

`IsPrime`

### Examples

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

[Package DescTools version 0.99.36 Index]