---
output:
  html_document:
    toc: true
    theme: united
  knitrBootstrap::bootstrap_document:
    theme.chooser: TRUE
    highlight.chooser: TRUE
---


<!--
%\VignetteEngine{knitr::rmarkdown}
%\VignetteIndexEntry{Introduction to regionReport}
-->

HTML reports for a set of regions
=================================

If you wish, you can view this vignette online [here](http://lcolladotor.github.io/regionReport/).


```{r vignetteSetup, echo = FALSE, message = FALSE, warning = FALSE}
## Track time spent on making the vignette
startTimeVignette <- Sys.time()

## Bib setup
library('knitcitations')

## Load knitcitations with a clean bibliography
cleanbib()
cite_options(hyperlink = 'to.doc', citation_format = 'text', style = 'html')
# Note links won't show for now due to the following issue
# https://github.com/cboettig/knitcitations/issues/63

## Write bibliography information
write.bibtex(c(knitcitations = citation('knitcitations'), 
    derfinder = citation('derfinder')[1], 
    regionReport = citation('regionReport')[1],
    knitrBootstrap = citation('knitrBootstrap'),
    ggbio = citation('ggbio'),
    ggplot2 = citation('ggplot2'),
    knitr = citation('knitr')[3],
    rmarkdown = citation('rmarkdown')),
    file = 'derfinderPlotRef.bib')
bib <- read.bibtex('derfinderPlotRef.bib')

## Assign short names
names(bib) <- c('knitcitations', 'derfinder', 'regionReport', 'knitrBootstrap',
    'ggbio', 'ggplot2', 'knitr', 'rmarkdown')
```


This is a vignette stub.

# Reproducibility

Code for creating the vignette

```{r createVignette, eval=FALSE, bootstrap.show.code=TRUE}
## Create the vignette
library('knitrBootstrap') 

knitrBootstrapFlag <- packageVersion('knitrBootstrap') < '1.0.0'
if(knitrBootstrapFlag) {
    ## CRAN version
    system.time(knit_bootstrap('regionReport.Rmd', chooser=c('boot', 'code'), show_code = TRUE))
    unlink('regionReport.md')
} else {
    ## GitHub version
    library('rmarkdown')
    system.time(render('regionReport.Rmd',
        'knitrBootstrap::bootstrap_document'))
}
## Note: if you prefer the knitr version use:
# library('rmarkdown')
# system.time(render('regionReport.Rmd', 'html_document'))

## Extract the R code
library('knitr')
knit('regionReport.Rmd', tangle = TRUE)

## Copy report output to be distributed with the package for comparison 
## purposes
file.copy(file.path('report', 'html', 'basicExploration.html'),
    '../inst/basicExploration/basicExploration.html', overwrite=TRUE)
       
## Clean up
file.remove('derfinderPlotRef.bib')
#unlink('regionReport_files', recursive=TRUE)
unlink('report', recursive = TRUE)
```

Date the vignette was generated.

```{r vignetteReproducibility1, echo=FALSE}
## Date the report was generated
Sys.time()
```

Wallclock time spent generating the vignette.

```{r vignetteReproducibility2, echo=FALSE, bootstrap.show.code=FALSE}
## Processing time in seconds
totalTimeVignette <- diff(c(startTimeVignette, Sys.time()))
round(totalTimeVignette, digits=3)
```

`R` session information.

```{r vignetteReproducibility3, echo=FALSE}
## Session info
library('devtools')
session_info()
```

# Bibliography

This vignette was generated using `knitrBootstrap` `r citep(bib[['knitrBootstrap']])`
with `knitr` `r citep(bib[['knitr']])` and `rmarkdown` `r citep(bib[['rmarkdown']])` running behind the scenes.

Citations made with `knitcitations` `r citep(bib[['knitcitations']])`.

```{r vignetteBiblio, results='asis', echo=FALSE}
## Print bibliography
bibliography()
```
