round_df | R Documentation |
Round all numeric columns in a data frame.
round_df(df, digits = 3)
df |
a data frame |
digits |
number of digits for the round function |
data frame with rounded values
https://stackoverflow.com/questions/9063889/how-to-round-a-data-frame-in-r-that-contains-some-character-variables
ID <- c("a", "b", "c", "d", "e")
Value1 <- as.numeric(c("3.4", "6.4", "8.7", "1.1", "0.1"))
Value2 <- as.numeric(c("8.2", "1.7", "6.4", "1.9", "10.3"))
df <- data.frame(ID, Value1, Value2, stringsAsFactors = FALSE)
# round_df(df, digits = 0)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.