We are going to knit and send an html document.

This will be a pretty cool trelliscope graph!!!

library(ggplot2)
library(trelliscopejs)
library(tidyverse) # dplyr, tidyr, .....
#Message = FALSE and warning = FALSE will suppress the messages in the knitted document
tx <- read.csv("tx.csv")
tx <- as_tibble(tx)

print(tx)
## # A tibble: 1,000,000 × 8
##        X pick_day   pick_dow total_amount tip_amount payment_type trip_duration
##    <int> <chr>      <chr>           <dbl>      <dbl> <chr>                <dbl>
##  1     1 2016-07-09 Sat             47.6       23.8  Card                 26.1 
##  2     2 2016-07-28 Thu              9.96       1.66 Card                  5.87
##  3     3 2016-07-20 Wed              6.8        1    Card                  4.92
##  4     4 2016-07-30 Sat             11.8        1.95 Card                 10.4 
##  5     5 2016-07-19 Tue              7.3        0    Cash                  6.87
##  6     6 2016-07-07 Thu             12.0        2.75 Card                  7.05
##  7     7 2016-07-29 Fri             13.8        0    Cash                 13.7 
##  8     8 2016-07-17 Sun             14.2        2.36 Card                 13.2 
##  9     9 2016-07-18 Mon             13.3        0    Cash                 13.7 
## 10    10 2016-07-14 Thu             21.8        2    Card                 29.3 
## # ℹ 999,990 more rows
## # ℹ 1 more variable: pick_wkday <lgl>
tx %>% 
  filter(tip_amount < 12) %>% 
  ggplot(aes(x = tip_amount)) +
  geom_histogram() + 
  ylim(c(0,1200)) +
  facet_trelliscope(~pick_day,
                    name = "Date",
                    desc = "Route data from 07/01/2016 to 12/31/2016",
                    nrow = 2, ncol = 3,
                    scales = c("same","same"),
                    path = ".", #this specifies the same path where the rmd file is located. Make sure there's only one html trelliscope in the folder. 
                    self_contained = TRUE  # this makes it so that the knitted html document won't need a local file for the trelliscope, 
                                           # it will now be embedded in the html file.
                    )