Tim Stuart     About     Archive     Publications     Feed

R demo

Table of Contents

Getting started

Clone the repo if you haven’t already:

git clone https://github.com/timoast/dac.git

Install RStudio.

Install the following packages:

install.packages(c("readr", "tidyr", "data.table", "dplyr", "ggplot2"))

All the following code will assume you are in the directory that holds this file (r_demo.rmd) in the github repo (ie dac/code/).

Importing Data

The readr way

Some docs

library(readr)

read_tsv("../data/coverages.tsv", col_names = c("Accession", "Coverage"))
## Parsed with column specification:
## cols(
##   Accession = col_character(),
##   Coverage = col_integer()
## )
## # A tibble: 216 × 2
##    Accession Coverage
##        <chr>    <int>
## 1       Aa-0       41
## 2      Abd-0       67
## 3       Ag-0       47
## 4       Ak-1       38
## 5     Alst-1       42
## 6    Altai-5       42
## 7     Amel-1       60
## 8       An-1       39
## 9      Ang-0       48
## 10  Anholt-1       53
## # ... with 206 more rows
# also works for gzipped files
read_tsv("../data/mc_data.bed.gz")
## Parsed with column specification:
## cols(
##   coords = col_character(),
##   ins0 = col_double(),
##   ins1 = col_double()
## )
## # A tibble: 999 × 3
##              coords        ins0        ins1
##               <chr>       <dbl>       <dbl>
## 1    chr1,8668,8746 0.000000000 0.005366726
## 2  chr1,17024,18924 0.005193408 0.004104893
## 3  chr1,18331,18642 0.003720434 0.008686003
## 4  chr1,23022,23145 0.000000000 0.004184100
## 5  chr1,55676,56576 0.004172405 0.012852597
## 6  chr1,69022,69135 0.008230453 0.004237288
## 7  chr1,69025,69143 0.003484013 0.003608475
## 8  chr1,69025,69148 0.002777778 0.007604563
## 9  chr1,69028,69133 0.005494505 0.000000000
## 10 chr1,76844,77500 0.003282397 0.003786529
## # ... with 989 more rows

The data.table way

Some docs

library(data.table)

fread("../data/coverages.tsv", header = FALSE, col.names = c("Accession", "Coverage"))
##      Accession Coverage
##   1:      Aa-0       41
##   2:     Abd-0       67
##   3:      Ag-0       47
##   4:      Ak-1       38
##   5:    Alst-1       42
##  ---                   
## 212:      Ws-2       52
## 213:      Wt-5       29
## 214:      Yo-0       78
## 215:     Zal-1       41
## 216:     Zdr-1       19
fread("gzip -dc ../data/mc_data.bed.gz")
##                      coords        ins0        ins1
##   1:         chr1,8668,8746 0.000000000 0.005366726
##   2:       chr1,17024,18924 0.005193408 0.004104893
##   3:       chr1,18331,18642 0.003720434 0.008686003
##   4:       chr1,23022,23145 0.000000000 0.004184100
##   5:       chr1,55676,56576 0.004172405 0.012852597
##  ---                                               
## 995: chr1,12566243,12568303 0.264952130 0.076252087
## 996: chr1,12581911,12582918 0.251092213 0.248537692
## 997: chr1,12584274,12584300 0.082298985 0.096469517
## 998: chr1,12594543,12594591 0.333835719 0.404032186
## 999: chr1,12612939,12613280 0.357346865 0.024760132
fread("seq 25 | xargs -n 5 echo")
##    V1 V2 V3 V4 V5
## 1:  1  2  3  4  5
## 2:  6  7  8  9 10
## 3: 11 12 13 14 15
## 4: 16 17 18 19 20
## 5: 21 22 23 24 25
fread("curl https://raw.githubusercontent.com/timoast/Arabidopsis-TE-variants/master/ProcessedData/coverages.tsv")
##          V1 V2
##   1:   Aa-0 41
##   2:  Abd-0 67
##   3:   Ag-0 47
##   4:   Ak-1 38
##   5: Alst-1 42
##  ---          
## 212:   Ws-2 52
## 213:   Wt-5 29
## 214:   Yo-0 78
## 215:  Zal-1 41
## 216:  Zdr-1 19
fread("bedtools intersect -a ../data/a.bed -b ../data/b.bed")
##      V1 V2  V3
## 1: chr1 20 100
## 2: chr1 50 100
## 3: chr1 20  50

data.table has lots of other useful functions, see datacamp course

Brief tangent – using fread to eliminate intermediate files

centromere_distance <- fread("bedtools closest -d -a ../data/c_dmrs.tsv.gz -b ../data/centromere_positions.txt")

hist(centromere_distance$V7 / 1000, breaks = 100, col = "blue",
     main = "C-DMR distances to centromere",
     xlab = "Distance (kb)")

plot of chunk plotting_example

densities <- hist(centromere_distance$V7, breaks = 500, plot = F)
image(as.matrix(densities$counts))

plot of chunk plotting_example

library(RColorBrewer)
colors <- colorRampPalette(brewer.pal(9,"RdYlBu"))(100)
image(as.matrix(densities$counts), col = rev(colors))

plot of chunk plotting_example

# create a scale bar
image(matrix(seq(100)), col = rev(colors))

plot of chunk plotting_example

Tidying data

Some background: Tidy data, Wickham 2014

Variables go in the columns, observations go in the rows.

Four main operations in tidying data:

library(tidyr)

data <- read_tsv("../data/experiment.tsv")
## Parsed with column specification:
## cols(
##   position = col_integer(),
##   experiment_1 = col_double(),
##   experiment_2 = col_double(),
##   experiment_3 = col_double(),
##   experiment_4 = col_double()
## )
data
## # A tibble: 500 × 5
##    position experiment_1 experiment_2 experiment_3 experiment_4
##       <int>        <dbl>        <dbl>        <dbl>        <dbl>
## 1         1    0.2947252    0.0000000   0.69056274    0.2240412
## 2         2    0.2624428    0.1944636   0.02995589    0.2823043
## 3         3    0.2227268    0.1696682   0.64657079    0.3024177
## 4         4    0.1863447    0.3532347   0.67337368    0.2075265
## 5         5    0.2532761    0.7560800   0.52507202    0.2844748
## 6         6    0.1269957    0.0000000   0.69156885    0.3399855
## 7         7    0.1476328    0.3013359   0.19931927    0.4005465
## 8         8    0.2202941    0.1325935   0.31909674    0.3487259
## 9         9    0.1886488    0.4738528   0.69180550    0.4154950
## 10       10    0.1971425    0.4245025   0.99153173    0.3800341
## # ... with 490 more rows
tidy_data <- gather(data, experiment, mC, experiment_1:experiment_4)
tidy_data
## # A tibble: 2,000 × 3
##    position   experiment        mC
##       <int>        <chr>     <dbl>
## 1         1 experiment_1 0.2947252
## 2         2 experiment_1 0.2624428
## 3         3 experiment_1 0.2227268
## 4         4 experiment_1 0.1863447
## 5         5 experiment_1 0.2532761
## 6         6 experiment_1 0.1269957
## 7         7 experiment_1 0.1476328
## 8         8 experiment_1 0.2202941
## 9         9 experiment_1 0.1886488
## 10       10 experiment_1 0.1971425
## # ... with 1,990 more rows
spread(tidy_data, experiment, mC)
## # A tibble: 500 × 5
##    position experiment_1 experiment_2 experiment_3 experiment_4
## *     <int>        <dbl>        <dbl>        <dbl>        <dbl>
## 1         1    0.2947252    0.0000000   0.69056274    0.2240412
## 2         2    0.2624428    0.1944636   0.02995589    0.2823043
## 3         3    0.2227268    0.1696682   0.64657079    0.3024177
## 4         4    0.1863447    0.3532347   0.67337368    0.2075265
## 5         5    0.2532761    0.7560800   0.52507202    0.2844748
## 6         6    0.1269957    0.0000000   0.69156885    0.3399855
## 7         7    0.1476328    0.3013359   0.19931927    0.4005465
## 8         8    0.2202941    0.1325935   0.31909674    0.3487259
## 9         9    0.1886488    0.4738528   0.69180550    0.4154950
## 10       10    0.1971425    0.4245025   0.99153173    0.3800341
## # ... with 490 more rows

Unite and separate columns

mc <- read_tsv("../data/mc_data.bed.gz")
## Parsed with column specification:
## cols(
##   coords = col_character(),
##   ins0 = col_double(),
##   ins1 = col_double()
## )
head(mc)
## # A tibble: 6 × 3
##             coords        ins0        ins1
##              <chr>       <dbl>       <dbl>
## 1   chr1,8668,8746 0.000000000 0.005366726
## 2 chr1,17024,18924 0.005193408 0.004104893
## 3 chr1,18331,18642 0.003720434 0.008686003
## 4 chr1,23022,23145 0.000000000 0.004184100
## 5 chr1,55676,56576 0.004172405 0.012852597
## 6 chr1,69022,69135 0.008230453 0.004237288
# first column has three variables: chromsome, start, end
new_mc <- separate(mc, coords, c("chr", "start", "end"))
new_mc
## # A tibble: 999 × 5
##      chr start   end        ins0        ins1
## *  <chr> <chr> <chr>       <dbl>       <dbl>
## 1   chr1  8668  8746 0.000000000 0.005366726
## 2   chr1 17024 18924 0.005193408 0.004104893
## 3   chr1 18331 18642 0.003720434 0.008686003
## 4   chr1 23022 23145 0.000000000 0.004184100
## 5   chr1 55676 56576 0.004172405 0.012852597
## 6   chr1 69022 69135 0.008230453 0.004237288
## 7   chr1 69025 69143 0.003484013 0.003608475
## 8   chr1 69025 69148 0.002777778 0.007604563
## 9   chr1 69028 69133 0.005494505 0.000000000
## 10  chr1 76844 77500 0.003282397 0.003786529
## # ... with 989 more rows
unite(new_mc, coords, chr, start, end, sep = ",")
## # A tibble: 999 × 3
##              coords        ins0        ins1
## *             <chr>       <dbl>       <dbl>
## 1    chr1,8668,8746 0.000000000 0.005366726
## 2  chr1,17024,18924 0.005193408 0.004104893
## 3  chr1,18331,18642 0.003720434 0.008686003
## 4  chr1,23022,23145 0.000000000 0.004184100
## 5  chr1,55676,56576 0.004172405 0.012852597
## 6  chr1,69022,69135 0.008230453 0.004237288
## 7  chr1,69025,69143 0.003484013 0.003608475
## 8  chr1,69025,69148 0.002777778 0.007604563
## 9  chr1,69028,69133 0.005494505 0.000000000
## 10 chr1,76844,77500 0.003282397 0.003786529
## # ... with 989 more rows

Manipulating data

The dplyr package:

library(dplyr)
# from earlier
coverages <- read_tsv("../data/coverages.tsv", col_names = c("Accession", "Coverage"))
## Parsed with column specification:
## cols(
##   Accession = col_character(),
##   Coverage = col_integer()
## )
# use mutate to create new columns
cov <- mutate(coverages, high = Coverage > 50)
cov
## # A tibble: 216 × 3
##    Accession Coverage  high
##        <chr>    <int> <lgl>
## 1       Aa-0       41 FALSE
## 2      Abd-0       67  TRUE
## 3       Ag-0       47 FALSE
## 4       Ak-1       38 FALSE
## 5     Alst-1       42 FALSE
## 6    Altai-5       42 FALSE
## 7     Amel-1       60  TRUE
## 8       An-1       39 FALSE
## 9      Ang-0       48 FALSE
## 10  Anholt-1       53  TRUE
## # ... with 206 more rows
# group rows by common variables
cov <- group_by(cov, high)
cov <- mutate(cov, group_average = mean(Coverage))
cov
## Source: local data frame [216 x 4]
## Groups: high [2]
## 
##    Accession Coverage  high group_average
##        <chr>    <int> <lgl>         <dbl>
## 1       Aa-0       41 FALSE      37.32609
## 2      Abd-0       67  TRUE      70.79487
## 3       Ag-0       47 FALSE      37.32609
## 4       Ak-1       38 FALSE      37.32609
## 5     Alst-1       42 FALSE      37.32609
## 6    Altai-5       42 FALSE      37.32609
## 7     Amel-1       60  TRUE      70.79487
## 8       An-1       39 FALSE      37.32609
## 9      Ang-0       48 FALSE      37.32609
## 10  Anholt-1       53  TRUE      70.79487
## # ... with 206 more rows
# use select to choose columns
select(cov, Accession, group_average)
## Adding missing grouping variables: `high`
## Source: local data frame [216 x 3]
## Groups: high [2]
## 
##     high Accession group_average
##    <lgl>     <chr>         <dbl>
## 1  FALSE      Aa-0      37.32609
## 2   TRUE     Abd-0      70.79487
## 3  FALSE      Ag-0      37.32609
## 4  FALSE      Ak-1      37.32609
## 5  FALSE    Alst-1      37.32609
## 6  FALSE   Altai-5      37.32609
## 7   TRUE    Amel-1      70.79487
## 8  FALSE      An-1      37.32609
## 9  FALSE     Ang-0      37.32609
## 10  TRUE  Anholt-1      70.79487
## # ... with 206 more rows
# won't let you drop a column if the data is grouped by that column
cov <- ungroup(cov)
select(cov, Accession, group_average)
## # A tibble: 216 × 2
##    Accession group_average
##        <chr>         <dbl>
## 1       Aa-0      37.32609
## 2      Abd-0      70.79487
## 3       Ag-0      37.32609
## 4       Ak-1      37.32609
## 5     Alst-1      37.32609
## 6    Altai-5      37.32609
## 7     Amel-1      70.79487
## 8       An-1      37.32609
## 9      Ang-0      37.32609
## 10  Anholt-1      70.79487
## # ... with 206 more rows
# can alse choose what NOT to include
select(cov, -high)
## # A tibble: 216 × 3
##    Accession Coverage group_average
##        <chr>    <int>         <dbl>
## 1       Aa-0       41      37.32609
## 2      Abd-0       67      70.79487
## 3       Ag-0       47      37.32609
## 4       Ak-1       38      37.32609
## 5     Alst-1       42      37.32609
## 6    Altai-5       42      37.32609
## 7     Amel-1       60      70.79487
## 8       An-1       39      37.32609
## 9      Ang-0       48      37.32609
## 10  Anholt-1       53      70.79487
## # ... with 206 more rows
# sort using arrange
arrange(cov, Coverage)
## # A tibble: 216 × 4
##        Accession Coverage  high group_average
##            <chr>    <int> <lgl>         <dbl>
## 1           Koln       11 FALSE      37.32609
## 2           Se-0       15 FALSE      37.32609
## 3           Ra-0       17 FALSE      37.32609
## 4          Wei-0       17 FALSE      37.32609
## 5          Old-1       18 FALSE      37.32609
## 6          Pu2-8       19 FALSE      37.32609
## 7         Ragl-1       19 FALSE      37.32609
## 8          Zdr-1       19 FALSE      37.32609
## 9           Bg-2       20 FALSE      37.32609
## 10 Buckhorn-Pass       20 FALSE      37.32609
## # ... with 206 more rows
arrange(cov, desc(Coverage))
## # A tibble: 216 × 4
##    Accession Coverage  high group_average
##        <chr>    <int> <lgl>         <dbl>
## 1       Br-0      133  TRUE      70.79487
## 2      Lan-0      127  TRUE      70.79487
## 3       Kb-0      110  TRUE      70.79487
## 4       El-0      107  TRUE      70.79487
## 5       La-0      102  TRUE      70.79487
## 6       Kl-5      100  TRUE      70.79487
## 7      Kar-1       97  TRUE      70.79487
## 8      Gel-1       96  TRUE      70.79487
## 9      Nok-3       96  TRUE      70.79487
## 10  Rennes-1       96  TRUE      70.79487
## # ... with 206 more rows
# useful for coordinates
dmrs <- read_tsv("../data/c_dmrs.tsv.gz", col_names = c("chr", "start", "end"))
## Parsed with column specification:
## cols(
##   chr = col_character(),
##   start = col_integer(),
##   end = col_integer()
## )
dmrs
## # A tibble: 13,484 × 3
##      chr  start    end
##    <chr>  <int>  <int>
## 1   chr1    792    911
## 2   chr1  22665  22807
## 3   chr1  41392  41445
## 4   chr1  71457  71476
## 5   chr1  76839  77252
## 6   chr1 193333 193525
## 7   chr1 255844 255893
## 8   chr1 291887 291998
## 9   chr1 355668 356037
## 10  chr1 428072 428073
## # ... with 13,474 more rows
arrange(dmrs, chr, desc(start))
## # A tibble: 13,484 × 3
##      chr    start      end
##    <chr>    <int>    <int>
## 1   chr1 30417725 30417837
## 2   chr1 30416592 30416901
## 3   chr1 30416104 30416138
## 4   chr1 30391058 30391076
## 5   chr1 30390110 30390285
## 6   chr1 30388868 30389254
## 7   chr1 30388263 30388288
## 8   chr1 30376878 30377010
## 9   chr1 30345730 30346096
## 10  chr1 30295026 30295310
## # ... with 13,474 more rows

Joining tables

dplyr also has join functions.

te_insertion_counts <- read_tsv("../data/insertion_counts.tsv", col_names = c("Accession", "Insertions"))
## Parsed with column specification:
## cols(
##   Accession = col_character(),
##   Insertions = col_integer()
## )
left_join(coverages, te_insertion_counts)
## Joining, by = "Accession"
## # A tibble: 216 × 3
##    Accession Coverage Insertions
##        <chr>    <int>      <int>
## 1       Aa-0       41        367
## 2      Abd-0       67        420
## 3       Ag-0       47        443
## 4       Ak-1       38        305
## 5     Alst-1       42        379
## 6    Altai-5       42        417
## 7     Amel-1       60        330
## 8       An-1       39        313
## 9      Ang-0       48        350
## 10  Anholt-1       53        343
## # ... with 206 more rows

Put it all together

In unix, the pipe lets you use output from one program/function as input to another. This lets you chain together commands an eliminate intermediate files. It also provides the ability to start one process before the previous has finished. For example you can pipe the output of bowtie into samtools and convert straight to bam without having to wait for the mapping to finish.

The same can be done in R with any function that takes and returns a dataframe. In unix the pipe character is |, in R it is %>%. The pipe is part of the magrittr package, but is also loaded any time you load readr, dplyr, or tidyr.

df <- read_tsv("../data/coverages.tsv", col_names = c("Accession", "Coverage")) %>%
  mutate(high = Coverage > 50) %>%
  group_by(high) %>%
  mutate(group_av = mean(Coverage)) %>%
  left_join(te_insertion_counts)
## Parsed with column specification:
## cols(
##   Accession = col_character(),
##   Coverage = col_integer()
## )
## Joining, by = "Accession"
df
## Source: local data frame [216 x 5]
## Groups: high [?]
## 
##    Accession Coverage  high group_av Insertions
##        <chr>    <int> <lgl>    <dbl>      <int>
## 1       Aa-0       41 FALSE 37.32609        367
## 2      Abd-0       67  TRUE 70.79487        420
## 3       Ag-0       47 FALSE 37.32609        443
## 4       Ak-1       38 FALSE 37.32609        305
## 5     Alst-1       42 FALSE 37.32609        379
## 6    Altai-5       42 FALSE 37.32609        417
## 7     Amel-1       60  TRUE 70.79487        330
## 8       An-1       39 FALSE 37.32609        313
## 9      Ang-0       48 FALSE 37.32609        350
## 10  Anholt-1       53  TRUE 70.79487        343
## # ... with 206 more rows

Plotting

library(ggplot2)

ggplot(df, aes(Coverage, Insertions)) +
  geom_point() + geom_smooth(method = "lm")

plot of chunk ggplot

ggplot(df, aes(Coverage, Insertions, color = high)) +
  geom_point() + geom_smooth(method = "lm")

plot of chunk ggplot

ggplot(df, aes(Coverage, Insertions)) +
  geom_point() + facet_wrap(~high) +
  theme_bw()

plot of chunk ggplot

ggplot(tidy_data, aes(experiment, mC)) +
  geom_jitter(alpha = 0.5) + theme_bw()

plot of chunk ggplot

Easily create interactive graphics

library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:graphics':
## 
##     layout
p <- ggplot(df, aes(Coverage, Insertions, label=Accession)) +
  geom_point() +
  theme_bw()

ggplotly(p)
## Error in loadNamespace(name): there is no package called 'webshot'
# from earlier
dmrs
## # A tibble: 13,484 × 3
##      chr  start    end
##    <chr>  <int>  <int>
## 1   chr1    792    911
## 2   chr1  22665  22807
## 3   chr1  41392  41445
## 4   chr1  71457  71476
## 5   chr1  76839  77252
## 6   chr1 193333 193525
## 7   chr1 255844 255893
## 8   chr1 291887 291998
## 9   chr1 355668 356037
## 10  chr1 428072 428073
## # ... with 13,474 more rows
ggplot(dmrs, aes(start)) +
  geom_density() + facet_wrap(~chr)

plot of chunk more_plots

# cleaned up
ggplot(dmrs, aes(start/1000)) +
  geom_density(adjust = 1/10, fill = "blue", alpha = 0.5) +
  facet_wrap(~chr, scales = "free") + theme_classic() +
  xlab("Position (kb)") + ggtitle("C-DMR Positions") +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

plot of chunk more_plots

Reporting

Use RMarkdown (included in RStudio). Press Knit HTML / Knit PDF to render the output document.

Displaying nice tables

# from before
data
## # A tibble: 500 × 5
##    position experiment_1 experiment_2 experiment_3 experiment_4
##       <int>        <dbl>        <dbl>        <dbl>        <dbl>
## 1         1    0.2947252    0.0000000   0.69056274    0.2240412
## 2         2    0.2624428    0.1944636   0.02995589    0.2823043
## 3         3    0.2227268    0.1696682   0.64657079    0.3024177
## 4         4    0.1863447    0.3532347   0.67337368    0.2075265
## 5         5    0.2532761    0.7560800   0.52507202    0.2844748
## 6         6    0.1269957    0.0000000   0.69156885    0.3399855
## 7         7    0.1476328    0.3013359   0.19931927    0.4005465
## 8         8    0.2202941    0.1325935   0.31909674    0.3487259
## 9         9    0.1886488    0.4738528   0.69180550    0.4154950
## 10       10    0.1971425    0.4245025   0.99153173    0.3800341
## # ... with 490 more rows
# using kable
head(data) %>% knitr::kable()
position experiment_1 experiment_2 experiment_3 experiment_4
1 0.2947252 0.0000000 0.6905627 0.2240412
2 0.2624428 0.1944636 0.0299559 0.2823043
3 0.2227268 0.1696682 0.6465708 0.3024177
4 0.1863447 0.3532347 0.6733737 0.2075265
5 0.2532761 0.7560800 0.5250720 0.2844748
6 0.1269957 0.0000000 0.6915689 0.3399855

Code block options

Can choose to show everything, show only output (eg plots), show nothing, show only warnings, etc..

Output options

Output can be rendered as html, pdf, or word. You can also choose a theme, and whether to show a table of contents. One important feature is the ability to have self-contained html documents by including self_contained: true in the rmarkdown header. This will let you send the html file to others and still have all the plots appear correct. This should be set as the default for html output.

Running code in other languages

It is possible to have code chunks that run in languages other than R. If you look at the first code chunk in this document, you will see that it runs a shell command (git). To find out more, read about language engines in knitr.

Here is an example running python:

chromosomes = ["chr" + str(i) for i in xrange(1, 6)]
print(chromosomes)
## ['chr1', 'chr2', 'chr3', 'chr4', 'chr5']

To use objects created by running code in other languages (for example, if we wanted to use the chromosomes variable created in the above python chunk), you will usually need to write the results to a file and then read into R from the file. There are complicated environment variable things you can do to share objects between languages, but these may not be worth the extra effort.

Further reading

http://r4ds.had.co.nz/

Session info

devtools::session_info()
## Session info --------------------------------------------------------------
##  setting  value                       
##  version  R version 3.3.1 (2016-06-21)
##  system   x86_64, darwin15.5.0        
##  ui       unknown                     
##  language (EN)                        
##  collate  en_AU.UTF-8                 
##  tz       Australia/Perth             
##  date     2016-09-22
## Packages ------------------------------------------------------------------
##  package      * version date       source                      
##  assertthat     0.1     2013-12-06 CRAN (R 3.3.0)              
##  base64enc      0.1-3   2015-07-28 CRAN (R 3.3.1)              
##  chron          2.3-47  2015-06-24 CRAN (R 3.3.0)              
##  colorspace     1.2-6   2015-03-11 CRAN (R 3.3.0)              
##  data.table   * 1.9.6   2015-09-19 CRAN (R 3.3.1)              
##  DBI            0.5-1   2016-09-10 CRAN (R 3.3.1)              
##  devtools       1.12.0  2016-06-24 CRAN (R 3.3.1)              
##  digest         0.6.10  2016-08-02 CRAN (R 3.3.1)              
##  dplyr        * 0.5.0   2016-06-24 CRAN (R 3.3.1)              
##  evaluate       0.9     2016-04-29 CRAN (R 3.3.0)              
##  formatR        1.4     2016-05-09 CRAN (R 3.3.1)              
##  ggplot2      * 2.1.0   2016-03-01 CRAN (R 3.3.1)              
##  gridExtra      2.2.1   2016-02-29 CRAN (R 3.3.1)              
##  gtable         0.2.0   2016-02-26 CRAN (R 3.3.0)              
##  highr          0.6     2016-05-09 CRAN (R 3.3.0)              
##  htmltools      0.3.5   2016-03-21 CRAN (R 3.3.0)              
##  htmlwidgets    0.7     2016-08-02 CRAN (R 3.3.1)              
##  httr           1.2.1   2016-07-03 CRAN (R 3.3.1)              
##  jsonlite       1.1     2016-09-14 CRAN (R 3.3.1)              
##  knitr          1.14.4  2016-09-22 Github (yihui/knitr@54ea64f)
##  labeling       0.3     2014-08-23 CRAN (R 3.3.0)              
##  lazyeval       0.2.0   2016-06-12 CRAN (R 3.3.0)              
##  magrittr       1.5     2014-11-22 CRAN (R 3.3.0)              
##  memoise        1.0.0   2016-01-29 CRAN (R 3.3.0)              
##  munsell        0.4.3   2016-02-13 CRAN (R 3.3.0)              
##  plotly       * 3.6.0   2016-05-18 CRAN (R 3.3.1)              
##  plyr           1.8.4   2016-06-08 CRAN (R 3.3.0)              
##  R6             2.1.3   2016-08-19 CRAN (R 3.3.1)              
##  RColorBrewer * 1.1-2   2014-12-07 CRAN (R 3.3.0)              
##  Rcpp           0.12.7  2016-09-05 CRAN (R 3.3.1)              
##  readr        * 1.0.0   2016-08-03 CRAN (R 3.3.1)              
##  scales         0.4.0   2016-02-26 CRAN (R 3.3.0)              
##  stringi        1.1.1   2016-05-27 CRAN (R 3.3.0)              
##  stringr        1.1.0   2016-08-19 CRAN (R 3.3.1)              
##  tibble         1.2     2016-08-26 CRAN (R 3.3.1)              
##  tidyr        * 0.6.0   2016-08-12 CRAN (R 3.3.1)              
##  viridis        0.3.4   2016-03-12 CRAN (R 3.3.1)              
##  withr          1.0.2   2016-06-20 CRAN (R 3.3.1)              
##  yaml           2.1.13  2014-06-12 CRAN (R 3.3.0)