-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathglobal.R
48 lines (42 loc) · 1.51 KB
/
global.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
library(shiny)
#pkgs <- c("markdown","devtools","ggplot2","knitr","plyr")
#pkgs <- pkgs[!(pkgs %in% installed.packages()[,"Package"])]
#if(length(pkgs)) install.packages(pkgs,repos="http://cran.cs.wwu.edu/")
library(plyr)
library(knitr)
library(markdown)
#library(devtools)
library(ggplot2)
#if(!("rCharts" %in% installed.packages()[,"Package"])) install_github("rCharts","thomasbrand")
library(rCharts)
load("data.RData")
helpPopup <- function(title, content,
placement=c('right', 'top', 'left', 'bottom'),
trigger=c('focus','hover', 'click', 'manual')) {
tagList(
singleton(
tags$head(
tags$script("$(function() { $(\"[data-toggle='popover']\").popover(); })")
)
),
tags$a(
href = "#", `data-toggle` = "popover", #class = "btn btn-mini",
title = title, `data-content` = content, `data-animation` = TRUE,
`data-placement` = match.arg(placement, several.ok=TRUE)[1],
`data-trigger` = match.arg(trigger, several.ok=TRUE)[1],
tags$i(class="icon-question-sign")
),
tags$style(type='text/css', ".popover { max-width: 500px !important;}")
)
}
includeRmd <- function(path){
if (!require(knitr))
stop("knitr package is not installed")
if (!require(markdown))
stop("Markdown package is not installed")
shiny:::dependsOnFile(path)
contents = paste(readLines(path, warn = FALSE), collapse = '\n')
html <- knitr::knit2html(text = contents, fragment.only = TRUE)
Encoding(html) <- 'UTF-8'
return(HTML(html))
}