Skip to content

Instantly share code, notes, and snippets.

@tbobin
Last active January 25, 2017 19:46
Show Gist options
  • Save tbobin/5f78c1b37d9accddc747d8fd300dbe4f to your computer and use it in GitHub Desktop.
Save tbobin/5f78c1b37d9accddc747d8fd300dbe4f to your computer and use it in GitHub Desktop.
---
title: "Test dynamic gauge generation"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
---
```{r setup, include=FALSE}
library(flexdashboard)
library(knitr)
```
Row
---------------------------
### Head
foo
```{r run-numeric-md}
out <- NULL
for (site in 1:2){
nextRow <- "\nRow\n-----------------------------------------------------------------------\n\n"
out <- c(out,nextRow)
for (i in 1:3){
head <- paste("\n### Site ",site,"\n\n")
out <- c(out,head)
val = (20*i)
g <- gauge(value = val , min =0, max=100, label= i )
show(g)
knitPrefix <- "\n```{r results='asis', cache=FALSE, echo=FALSE}\n\n"
knitSuffix <- "\n\n```"
g <- paste0(knitPrefix,"gauge(value = ",val," , min =0, max=100, label= \"KPI ",i,"\" )",knitSuffix)
out <- c(out, g)
}
}
```
`r paste(knit(text = out), collapse = '\n')`
Row
---------------------------
### Comment
foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment