我尝试使用area()
函数创建一个带有百分比值的表。但实际上它根本不起作用(即百分比值)。有谁知道如何修理它?
#library(magrittr)
#library(dplyr)
#library(formattable)
#library(scales)
set.seed(123)
df <- data.frame(id = 1:10,
a = rnorm(10), b = rnorm(10), c = rnorm(10))
df <- df %>%
mutate(a = percent(a), b = percent(b), c = percent(c))
# show percentage value without using area function
formattable(df, list(a = color_tile("transparent", "pink"),
b = color_tile("transparent", "pink"),
c = color_tile("transparent", "pink")))
# does not show percentage value
formattable(df, list(area(col = a:c) ~ color_tile("transparent", "pink")))
sessionInfo()
[1] formattable_0.2 DT_0.1 scales_0.4.0
[4] tidyr_0.4.1 rCharts_0.4.5 dplyr_0.4.3
[7] shiny_0.13.2