Description Usage Arguments Value Examples
create a tree-structure from a data.frame
1 2 | vt_input_from_df(inp, scaleToPerc = FALSE, hierachyVar0 = NULL,
hierachyVar1, hierachyVar2, colorVar, weightVar, labelVar = NULL)
|
inp |
a data.frame with specific format |
scaleToPerc |
(logical) scale to percent |
hierachyVar0 |
(character) variable name of toplevel hierachy (will be replaced with "Total" if empty) |
hierachyVar1 |
(character) variable name of first level |
hierachyVar2 |
(character) variable name of second level |
colorVar |
(character) variable name of the color information |
weightVar |
(character) variable name of the weight information |
labelVar |
(character) variable name of (short) labels |
a Node that can be written to json using vt_export_json
1 2 3 4 5 6 7 8 9 10 11 | data(canada)
canada <- canada[canada$h1=="Canada",]
canada$codes <- canada$h3
v1 <- vt_input_from_df(canada, hierachyVar0 = "h1", hierachyVar1 = "h2",
hierachyVar2 = "h3", colorVar = "color",weightVar = "weight",
labelVar = "codes")
colnames(canada) <- c("hier1","hier2","hier3","col","w","cod")
v2 <- vt_input_from_df(canada, hierachyVar0 = "hier1", hierachyVar1 = "hier2",
hierachyVar2 = "hier3", colorVar = "col",weightVar = "w",
labelVar = "cod")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.