Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Feb 3, 2016
0 parents commit 990d10c
Show file tree
Hide file tree
Showing 12 changed files with 324 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
^.*\.Rproj$
^\.Rproj\.user$
^examples/$


4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
10 changes: 10 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Generated by roxygen2: do not edit by hand

export(keen_dashboard)
import(rmarkdown)
50 changes: 50 additions & 0 deletions R/keen_dashboard.R
Original file line number Diff line number Diff line change
@@ -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)
)

}

4 changes: 4 additions & 0 deletions R/package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


#' @import rmarkdown
NULL
21 changes: 21 additions & 0 deletions dashboards.Rproj
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Untitled*
66 changes: 66 additions & 0 deletions examples/Untitled.Rmd
Original file line number Diff line number Diff line change
@@ -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>
146 changes: 146 additions & 0 deletions inst/rmarkdown/templates/keen_dashboard/resources/default.html
Original file line number Diff line number Diff line change
@@ -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>
12 changes: 12 additions & 0 deletions man/hello.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
\name{hello}
\alias{hello}
\title{Hello, World!}
\usage{
hello()
}
\description{
Prints 'Hello, world!'.
}
\examples{
hello()
}
1 change: 1 addition & 0 deletions tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dashboards/

0 comments on commit 990d10c

Please sign in to comment.