round_to | R Documentation |
Round numbers to a fixed number of decimal places
round_to(x, digits = 2)
x |
(Numeric) A vector of numbers. |
digits |
(Numeric) Number of decimal places to keep. |
A numeric vector.
Jeromy Anglim (https://stackoverflow.com/users/180892/jeromy-anglim)
https://stackoverflow.com/a/12135122
vec <- c(1.739006, 2, -1.4, 1.05, 1.90, 3.826)
round_to(vec, digits = 3)
#> [1] "1.739" "2.000" "-1.400" "1.050" "1.900" "3.826"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.