library(DT) library(dplyr) library(magrittr) library(purrr) library(data.tree) library(htmlwidgets) library(rstudioapi) setwd(dirname(getActiveDocumentContext()$path)) source(file="../R/TT.r") source(file="../R/TTformat.r") load(file="../data/col_order.rda") load(file="../data/org.rda") load(file="../R/sysdata.rda") colnames <- factor(c("org",org$attributesAll), levels = col_order)
treetable(data.frame( date = seq(as.Date("2015-01-01"), by = "day", length.out = 5), x = 1:5 ))
# apply CSS styles to columns treetable(iris) %>% formatStyle('Sepal.Length', fontWeight = styleInterval(5, c('bold', 'weight'))) %>% formatStyle('Sepal.Width', color = styleInterval(3.4, c('red', 'white')), backgroundColor = styleInterval(3.4, c('yellow', 'gray')) )
res <- treetable(org, color="#FFFFFF", colnames=colnames, rownames=FALSE) # remove appended js with files so easier debugging res$append <- "" res
res<-treetable(org) res$append <- "" res
res<-treetable(org, colnames = col_order, rownames=FALSE) %>% formatRound(columns = 2, digits = 0) %>% formatCurrency(columns = 3, currency = "$", digits=2, before = TRUE) %>% formatPercentage(columns = 4, digits = 0) %>% formatSignif(columns = 6, digits = 3, interval = 2) %>% formatString(columns = 1, prefix = "org_") %>% formatStyle(columns = c(7,8), valueColumns = 7, backgroundColor = styleInterval(300,c('yellow','gray'))) res$append <- "" res
lenAttr <- length(org$attributes) org$Do(function(node){ nAttr <- runif(1,min=1,max=lenAttr) # number of attributes to delete selAttr <- runif(nAttr,min=1,max=lenAttr) # selected attributes to delete rmAttr <- node$attributes[selAttr] %>% unique map(rmAttr, ~node$RemoveAttribute(.x)) }) res<-treetable(org, colnames=colnames) res$append <- "" res load(file="../data/org.rda")
orrg <- Node$new() orrg$AddChildNode(org) treetable(orrg, colnames=colnames)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.