- +5 −0 .Rbuildignore
- +4 −0 .gitignore
- +10 −0 DESCRIPTION
- +4 −0 NAMESPACE
- +50 −0 R/keen_dashboard.R
- +4 −0 R/package.R
- +21 −0 dashboards.Rproj
- +1 −0 examples/.gitignore
- +66 −0 examples/Untitled.Rmd
- +146 −0 inst/rmarkdown/templates/keen_dashboard/resources/default.html
- +12 −0 man/hello.Rd
- +1 −0 tools/.gitignore
| @@ -0,0 +1,5 @@ | ||
| ^.*\.Rproj$ | ||
| ^\.Rproj\.user$ | ||
| ^examples/$ | ||
|
|
||
|
|
| @@ -0,0 +1,4 @@ | ||
| .Rproj.user | ||
| .Rhistory | ||
| .RData | ||
| .Ruserdata |
| @@ -0,0 +1,10 @@ | ||
| Package: dashboards | ||
| Type: Package | ||
| Title: What the Package Does (Title Case) | ||
| Version: 0.1.0 | ||
| Author: Who wrote it | ||
| Maintainer: Who to complain to <yourfault@somewhere.net> | ||
| Description: More about what it does (maybe more than one line) | ||
| License: What license is it under? | ||
| LazyData: TRUE | ||
| RoxygenNote: 5.0.1 |
| @@ -0,0 +1,4 @@ | ||
| # Generated by roxygen2: do not edit by hand | ||
|
|
||
| export(keen_dashboard) | ||
| import(rmarkdown) |
| @@ -0,0 +1,50 @@ | ||
|
|
||
|
|
||
|
|
||
| #'@export | ||
| keen_dashboard <- function(smart = TRUE, | ||
| self_contained = TRUE, | ||
| theme = "default", | ||
| css = NULL, | ||
| includes = NULL, | ||
| lib_dir = NULL, | ||
| md_extensions = NULL, | ||
| pandoc_args = NULL) { | ||
|
|
||
|
|
||
| # build pandoc args | ||
| args <- c("--standalone") | ||
|
|
||
| # use section divs | ||
| args <- c(args, "--section-divs") | ||
|
|
||
| # additional css | ||
| for (css_file in css) | ||
| args <- c(args, "--css", pandoc_path_arg(css_file)) | ||
|
|
||
| # add template | ||
| args <- c(args, "--template", | ||
| pandoc_path_arg(system.file(package = "dashboards", | ||
| "rmarkdown/templates/keen_dashboard/resources/default.html"))) | ||
|
|
||
| # determine knitr options | ||
| knitr_options <- knitr_options_html(4, 4, FALSE, FALSE, "png") | ||
| knitr_options$opts_chunk$echo = FALSE | ||
|
|
||
| # return format | ||
| output_format( | ||
| knitr = knitr_options, | ||
| pandoc = pandoc_options(to = "html", | ||
| from = rmarkdown_format(md_extensions), | ||
| args = args), | ||
| keep_md = FALSE, | ||
| clean_supporting = self_contained, | ||
| base_format = html_document_base(smart = smart, theme = theme, | ||
| self_contained = self_contained, | ||
| lib_dir = lib_dir, mathjax = NULL, | ||
| template = "default", | ||
| pandoc_args = pandoc_args) | ||
| ) | ||
|
|
||
| } | ||
|
|
| @@ -0,0 +1,4 @@ | ||
|
|
||
|
|
||
| #' @import rmarkdown | ||
| NULL |
| @@ -0,0 +1,21 @@ | ||
| Version: 1.0 | ||
|
|
||
| RestoreWorkspace: Default | ||
| SaveWorkspace: Default | ||
| AlwaysSaveHistory: Default | ||
|
|
||
| EnableCodeIndexing: Yes | ||
| UseSpacesForTab: Yes | ||
| NumSpacesForTab: 2 | ||
| Encoding: UTF-8 | ||
|
|
||
| RnwWeave: Sweave | ||
| LaTeX: pdfLaTeX | ||
|
|
||
| AutoAppendNewline: Yes | ||
| StripTrailingWhitespace: Yes | ||
|
|
||
| BuildType: Package | ||
| PackageUseDevtools: Yes | ||
| PackageInstallArgs: --no-multiarch --with-keep.source | ||
| PackageRoxygenize: rd,collate,namespace |
| @@ -0,0 +1 @@ | ||
| Untitled* |
| @@ -0,0 +1,66 @@ | ||
| --- | ||
| title: "Untitled" | ||
| output: | ||
| dashboards::keen_dashboard: | ||
| self_contained: false | ||
| --- | ||
|
|
||
| ```{r setup, include=FALSE} | ||
| library(dygraphs) | ||
| ``` | ||
|
|
||
| <div class="row"> | ||
|
|
||
| <div class="col-sm-6"> | ||
| <div class="chart-wrapper"> | ||
| <div class="chart-title"> | ||
| Pageviews by browser (past 24 hours) | ||
| </div> | ||
| <div class="chart-stage"> | ||
|
|
||
| ```{r} | ||
| dygraph(ldeaths) | ||
| ``` | ||
|
|
||
| </div> | ||
| <div class="chart-notes"> | ||
| This is a sample text region to describe this chart. | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div class="col-sm-6"> | ||
| <div class="chart-wrapper"> | ||
| <div class="chart-title"> | ||
| Pageviews by browser (past 5 days) | ||
| </div> | ||
| <div class="chart-stage"> | ||
|
|
||
|
|
||
| </div> | ||
| <div class="chart-notes"> | ||
| Notes go down here | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| </div> | ||
|
|
||
|
|
||
| <div class="row"> | ||
|
|
||
| <div class="col-sm-12"> | ||
| <div class="chart-wrapper"> | ||
| <div class="chart-title"> | ||
| Impressions by advertiser | ||
| </div> | ||
| <div class="chart-stage"> | ||
|
|
||
| </div> | ||
| <div class="chart-notes"> | ||
| Notes go down here | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| </div> |
| @@ -0,0 +1,146 @@ | ||
| <!DOCTYPE html> | ||
| <html xmlns="http://www.w3.org/1999/xhtml"$if(lang)$ lang="$lang$" xml:lang="$lang$"$endif$> | ||
| <head> | ||
|
|
||
| <meta charset="utf-8"> | ||
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
| <meta name="generator" content="pandoc" /> | ||
|
|
||
| <title>$if(title-prefix)$$title-prefix$ - $endif$$pagetitle$</title> | ||
|
|
||
| <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' /> | ||
|
|
||
| $for(header-includes)$ | ||
| $header-includes$ | ||
| $endfor$ | ||
|
|
||
| <style type="text/css"> | ||
|
|
||
| /* | ||
| * Full-page application style | ||
| */ | ||
|
|
||
| body.application { | ||
| background: #f2f2f2; | ||
| padding: 60px 20px 0; | ||
| } | ||
| body.application > .container-fluid { | ||
| padding-left: 0; | ||
| padding-right: 0; | ||
| } | ||
| body.application div[class^="col-"] { | ||
| padding-left: 5px; | ||
| padding-right: 5px; | ||
| } | ||
| body.application div[class^="col-"] div[class^="col-"] { | ||
| padding-left: 15px; | ||
| padding-right: 15px; | ||
| } | ||
|
|
||
| body.application hr { | ||
| border-color: #d7d7d7; | ||
| margin: 10px 0; | ||
| } | ||
|
|
||
|
|
||
| .navbar-inverse { | ||
| background-color: #3d4a57; | ||
| border-color: #333; | ||
| } | ||
| .navbar-inverse .navbar-nav > li > a, | ||
| .navbar .navbar-brand { | ||
| color: #fbfbfb; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .main-nav > li > a:hover { | ||
| border-bottom: 2px solid transparent; | ||
| -webkit-transition: border 300ms ease; | ||
| -o-transition: border 300ms ease; | ||
| transition: border 300ms ease; | ||
| border-bottom-color: white; | ||
| } | ||
|
|
||
| .return-link, .return-link:focus, .return-link:hover { | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .chart-wrapper { | ||
| background: #fff; | ||
| border: 1px solid #e2e2e2; | ||
| border-radius: 3px; | ||
| margin-bottom: 10px; | ||
| } | ||
| .chart-wrapper .chart-title { | ||
| border-bottom: 1px solid #d7d7d7; | ||
| color: #666; | ||
| font-size: 14px; | ||
| font-weight: 200; | ||
| padding: 7px 10px 4px; | ||
| } | ||
|
|
||
| .chart-wrapper .chart-stage { | ||
| /*min-height: 240px;*/ | ||
| overflow: hidden; | ||
| padding: 5px 10px; | ||
| position: relative; | ||
| } | ||
|
|
||
| .chart-wrapper .chart-notes { | ||
| background: #fbfbfb; | ||
| border-top: 1px solid #e2e2e2; | ||
| color: #808080; | ||
| font-size: 12px; | ||
| padding: 8px 10px 5px; | ||
| } | ||
|
|
||
| div.html-widget-static-bound { | ||
| width: 100% !important; | ||
| } | ||
|
|
||
| </style> | ||
|
|
||
|
|
||
| $for(css)$ | ||
| <link rel="stylesheet" href="$css$" $if(html5)$$else$type="text/css" $endif$/> | ||
| $endfor$ | ||
|
|
||
| </head> | ||
|
|
||
| <body class="application"> | ||
|
|
||
| <div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> | ||
| <div class="container-fluid"> | ||
| <div class="navbar-header"> | ||
| <a class="navbar-brand" href="">Dashboard</a> | ||
| </div> | ||
| </div> | ||
| </div> | ||
|
|
||
| $for(include-before)$ | ||
| $include-before$ | ||
| $endfor$ | ||
|
|
||
| <div class="container-fluid"> | ||
|
|
||
| $body$ | ||
|
|
||
| </div> | ||
|
|
||
| <script type="text/javascript"> | ||
|
|
||
| $$(document).ready(function () { | ||
|
|
||
|
|
||
| } | ||
|
|
||
| </script> | ||
|
|
||
|
|
||
|
|
||
| $for(include-after)$ | ||
| $include-after$ | ||
| $endfor$ | ||
|
|
||
| </body> | ||
| </html> |
| @@ -0,0 +1,12 @@ | ||
| \name{hello} | ||
| \alias{hello} | ||
| \title{Hello, World!} | ||
| \usage{ | ||
| hello() | ||
| } | ||
| \description{ | ||
| Prints 'Hello, world!'. | ||
| } | ||
| \examples{ | ||
| hello() | ||
| } |
| @@ -0,0 +1 @@ | ||
| dashboards/ |