#---------------------------------------------------------------------------------------------------------
#! to_format <- function(x, def = 1) : numeric to convenient format (no more then 5 symbols)
#---------------------------------------------------------------------------------------------------------
to_format <- function(x, def = 1) {
# numeric to convinient format (no more then 5 symbols)
if(is.na(x)) 'NA' else if((.01 < x && x < 999) || x == 0) {
format(x, digits = 2)
} else {
format(x, digits = 2, scientific = TRUE)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.