gvisTable
gained a new argument formats
that allow users to define the formats numbers displayed in tables. Thanks to J. Buros, who contributed the code.Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dat <- data.frame(Product=c("Milk", "Butter", "Yoghurt", "<b>Sum</b>"), | |
Revenue=c(2230, 43908, 231, 46369)) | |
dat <- within(dat, {'% of Revenue' <- c(Revenue / Revenue[4])}) | |
library(googleVis) | |
tbl <- gvisTable(dat, options=list(width=300, height=150), | |
formats=list(Revenue="#,###", '% of Revenue'='#.#%'), | |
chartid="formattedtable") | |
plot(tbl) |
Session Info
R version 3.0.1 (2013-05-16)
Platform: x86_64-apple-darwin10.8.0 (64-bit)
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] googleVis_0.4.4
loaded via a namespace (and not attached):
[1] RJSONIO_1.0-3 tools_3.0.1