Skip to content

Instantly share code, notes, and snippets.

@mages
Last active December 21, 2015 17:28
Show Gist options
  • Save mages/6340383 to your computer and use it in GitHub Desktop.
Save mages/6340383 to your computer and use it in GitHub Desktop.
A formatted table with googleVis. Requires googleVis 0.4.4 or higher
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment