#' Round dataframe
#'
#' Round numeric datas in a dataframe: round only numeric variables
#'
#' @param x A dataframe
#' @param digits Number of digits to round
#'
#' @return Rounded dataframe
#'
#' @export
round_df <- function(D, digits) {
#Get numeric columns
#numeric_columns <- sapply(D, mode) == 'numeric'
numeric_columns <- sapply(D, is.numeric) == 'TRUE'
#Round only numeric columns directly in dataframe
D[numeric_columns] <- round(D[numeric_columns], digits)
return(D)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.