library(tidyverse)
library(readxl)
library(lubridate)

# https://blogs.reed.edu/ed-tech/2015/10/creating-nice-tables-using-r-markdown/
library(knitr) #kable
#library(xtable) # xtable: generate LaTeX code to output table into PDF  

library(highcharter)


My Statistical Analysis for My Poker Statistics


This visualization is interactive in the way that the plots are responsive to the move of the curser, with corresponding information displayed.


1. Data Preparation

#filePath <- file.choose()
filePath <- "/Users/apple/Desktop/YuqingRWork/Poker/DesciplinePokerAtheletes.xlsx"  # 
GoogleSheet <- read_excel(filePath)

Testimate <- GoogleSheet %>% mutate(Date = ymd(Date), #sesStart = ymd_hms(sesStart), sesEnd = ymd_hms(sesEnd),
                             #Stake = as.integer(Stake),
                             sesLength = round( as.numeric(sesEnd - sesStart), 2), #directly make substraction between times
                             Profit = cashOut - buyIn, 
                             profitPerHr = Profit/sesLength,
                             totalProfit = promoBonus + Profit,
                             totalProfitPerHr = totalProfit/sesLength, 
                             accuHour = cumsum(sesLength),
                             accuProfit = cumsum(Profit), 
                             accuProfitPerHr = accuProfit/accuHour,
                             accuTotalProfit = cumsum(totalProfit),
                             accuTotalProfitPerHr = accuTotalProfit/accuHour) 

#options(tibble.width = Inf)  
#options(tibble.print_max = 15, tibble.print_min = 5) # if more than 15 rows, print 5 rows
#Testimate

# Day of Profit
#Testimate %>% filter(Day == "Fri") 



# pending problem: accuProfit is incorrect (still goes with the whole stat) in specific day checking

My performance on Monday:

## # A tibble: 14 x 7
##    Day   Stake sesStart            sesEnd              sesLength Profit
##    <chr> <dbl> <dttm>              <dttm>                  <dbl>  <dbl>
##  1 Mon     3   2019-03-04 12:25:00 2019-03-04 19:24:00      6.98   1240
##  2 Mon     3   2019-11-19 00:50:00 2019-11-19 04:57:00      4.12    881
##  3 Mon     3   2019-05-13 13:35:00 2019-05-13 18:06:00      4.52    782
##  4 Mon     3   2019-02-18 10:38:00 2019-02-18 18:00:00      7.37    570
##  5 Mon     2   2018-12-03 14:15:00 2018-12-03 19:25:00      5.17    551
##  6 Mon     3   2019-03-11 19:05:00 2019-03-12 02:30:00      7.42    515
##  7 Mon     2   2019-11-25 21:55:00 2019-11-26 00:33:00      2.63    408
##  8 Mon     2   2019-05-20 12:32:00 2019-05-20 15:35:00      3.05    314
##  9 Mon     2   2019-07-01 20:54:00 2019-07-02 02:35:00      5.68    277
## 10 Mon     2.9 2019-08-19 12:41:00 2019-08-19 17:18:00      4.62    239
## 11 Mon     3   2019-08-26 11:52:00 2019-08-26 17:06:00      5.23    177
## 12 Mon     2   2019-07-08 22:20:00 2019-07-09 05:43:00      7.38   -138
## 13 Mon     3   2019-06-24 16:19:00 2019-06-24 18:53:00      2.57   -450
## 14 Mon     2.6 2019-09-02 09:14:00 2019-09-02 14:53:00      5.65  -1278
## # ... with 1 more variable: profitPerHr <dbl>
Testimate %>% 
  select(Day, Stake, sesStart,  sesLength, Profit, profitPerHr) %>% 
    arrange(desc(profitPerHr))  #%>% View()
## # A tibble: 74 x 6
##    Day   Stake sesStart            sesLength Profit profitPerHr
##    <chr> <dbl> <dttm>                  <dbl>  <dbl>       <dbl>
##  1 Thu     3   2019-03-14 23:48:00      6.8    2320        341.
##  2 Fri     2.9 2018-12-14 22:24:00      3.93   1312        334.
##  3 Mon     3   2019-11-19 00:50:00      4.12    881        214.
##  4 Fri     2   2019-02-16 02:03:00      4.87    959        197.
##  5 Mon     3   2019-03-04 12:25:00      6.98   1240        178.
##  6 Mon     3   2019-05-13 13:35:00      4.52    782        173.
##  7 Fri     2.8 2019-08-30 19:21:00      3.63    568        156.
##  8 Thu     2.2 2018-12-06 21:50:00      3.22    501        156.
##  9 Mon     2   2019-11-25 21:55:00      2.63    408        155.
## 10 Wed     2   2019-06-05 21:28:00      2.95    391        133.
## # ... with 64 more rows

*Tibble output options https://r4ds.had.co.nz/tibbles.html 10.3.1


A separate data set to be analyzed: Session with “The Course” mindset

#Enlightened <- Testimate %>% filter(Date >= "2018-11-29") intuitive, but wrong, w.r.t cumulative values which are computed/had memory from overall dataset

EnlightenedEra <- GoogleSheet %>% mutate(Date = ymd(Date), #sesStart = ymd_hms(sesStart), sesEnd = ymd_hms(sesEnd),
                                  sesLength = round( as.numeric(sesEnd - sesStart), 2), #directly make substraction between times                             
                                  #Stake = as.integer(Stake),
                                  Profit = cashOut - buyIn, 
                                  profitPerHr = Profit/sesLength,
                                  totalProfit = promoBonus + Profit, # totalProfit add promotion earnings
                                  totalProfitPerHr = totalProfit/sesLength) %>% 
                                  filter(Date >= "2018-11-29") %>% mutate(accuHour = cumsum(sesLength),
                                                                   accuProfit = cumsum(Profit), 
                                                                   accuProfitPerHr = accuProfit/accuHour,
                                                                   accuTotalProfit = cumsum(totalProfit),
                                                                   accuTotalProfitPerHr = accuTotalProfit/accuHour) 
#options(tibble.width = Inf)  
#options(tibble.print_max = 15, tibble.print_min = 5) # if more than 15 rows, print 5 rows
EnlightenedEra
## # A tibble: 60 x 19
##    Date       Day   Stake Toughness sesStart            sesEnd             
##    <date>     <chr> <dbl>     <dbl> <dttm>              <dttm>             
##  1 2018-11-29 Thu     2           2 2018-11-29 20:44:00 2018-11-30 02:54:00
##  2 2018-11-30 Fri     3           3 2018-11-30 23:59:00 2018-12-01 03:45:00
##  3 2018-12-03 Mon     2           2 2018-12-03 14:15:00 2018-12-03 19:25:00
##  4 2018-12-06 Thu     2.2         3 2018-12-06 21:50:00 2018-12-07 01:03:00
##  5 2018-12-08 Fri     2.1         5 2018-12-08 00:48:00 2018-12-08 04:10:00
##  6 2018-12-12 Wed     2           3 2018-12-12 22:30:00 2018-12-13 03:15:00
##  7 2018-12-14 Fri     2.9         3 2018-12-14 22:24:00 2018-12-15 02:20:00
##  8 2018-12-15 Sat     2.2         3 2018-12-15 21:55:00 2018-12-16 04:55:00
##  9 2018-12-26 Wed     3           3 2018-12-26 21:45:00 2018-12-27 05:35:00
## 10 2019-01-03 Thu     2.4         2 2019-01-03 22:38:00 2019-01-04 06:28:00
## # ... with 50 more rows, and 13 more variables: buyIn <dbl>,
## #   promoBonus <dbl>, cashOut <dbl>, sesLength <dbl>, Profit <dbl>,
## #   profitPerHr <dbl>, totalProfit <dbl>, totalProfitPerHr <dbl>,
## #   accuHour <dbl>, accuProfit <dbl>, accuProfitPerHr <dbl>,
## #   accuTotalProfit <dbl>, accuTotalProfitPerHr <dbl>
# command+shift+C
EnlightenedEra %>% 
  select(Day, Stake, sesStart,  sesLength, Profit, profitPerHr) %>% 
    arrange(desc(Profit)) #%>% View() # arrange(desc(sesLength))
## # A tibble: 60 x 6
##    Day   Stake sesStart            sesLength Profit profitPerHr
##    <chr> <dbl> <dttm>                  <dbl>  <dbl>       <dbl>
##  1 Thu     3   2019-03-14 23:48:00      6.8    2320       341. 
##  2 Fri     2.9 2018-12-14 22:24:00      3.93   1312       334. 
##  3 Mon     3   2019-03-04 12:25:00      6.98   1240       178. 
##  4 Wed     2   2019-05-01 13:48:00      8.95    973       109. 
##  5 Fri     3   2020-01-05 02:50:00     10.4     963        92.4
##  6 Fri     2   2019-02-16 02:03:00      4.87    959       197. 
##  7 Mon     3   2019-11-19 00:50:00      4.12    881       214. 
##  8 Mon     3   2019-05-13 13:35:00      4.52    782       173. 
##  9 Tue     2   2019-05-07 19:52:00      9.83    640        65.1
## 10 Fri     3   2019-09-13 16:59:00      5.55    594       107. 
## # ... with 50 more rows
EnlightenedEra %>%
  select(Day, Stake, sesStart,  sesLength, Profit, profitPerHr) %>%
    filter(Stake > 2) %>% 
      arrange(desc(Profit))
## # A tibble: 35 x 6
##    Day   Stake sesStart            sesLength Profit profitPerHr
##    <chr> <dbl> <dttm>                  <dbl>  <dbl>       <dbl>
##  1 Thu     3   2019-03-14 23:48:00      6.8    2320       341. 
##  2 Fri     2.9 2018-12-14 22:24:00      3.93   1312       334. 
##  3 Mon     3   2019-03-04 12:25:00      6.98   1240       178. 
##  4 Fri     3   2020-01-05 02:50:00     10.4     963        92.4
##  5 Mon     3   2019-11-19 00:50:00      4.12    881       214. 
##  6 Mon     3   2019-05-13 13:35:00      4.52    782       173. 
##  7 Fri     3   2019-09-13 16:59:00      5.55    594       107. 
##  8 Mon     3   2019-02-18 10:38:00      7.37    570        77.3
##  9 Fri     2.8 2019-08-30 19:21:00      3.63    568       156. 
## 10 Mon     3   2019-03-11 19:05:00      7.42    515        69.4
## # ... with 25 more rows


Profit & total profit by day & by day per hour: Overall

options(tibble.width = Inf)  

Testimate %>% 
  group_by(Day) %>%
  summarise(
    count = n(),
    sesLengthByDay = round( mean(sesLength),2),
    profitByDay = round(mean(Profit),2),
    profitPerHrByDay = round(profitByDay/sesLengthByDay,2),
    totalProfitByDay = round(mean(totalProfit),2), # totalProfit including promotion earnings
    totalProfitPerHrByDay = round(totalProfitByDay/sesLengthByDay,2)
    ) %>% kable()
Day count sesLengthByDay profitByDay profitPerHrByDay totalProfitByDay totalProfitPerHrByDay
Feb 1 10.78 402.00 37.29 502.00 46.57
Fri 21 6.64 -26.43 -3.98 -26.43 -3.98
Mon 14 5.17 292.00 56.48 292.00 56.48
Sat 8 6.07 -189.12 -31.16 -114.12 -18.80
Thu 16 6.47 244.88 37.85 276.12 42.68
Tue 3 9.54 26.00 2.73 26.00 2.73
Wed 11 6.16 209.36 33.99 227.55 36.94

Pending: drop-down table, or straight go for Shiny.


Profit & total profit by day & by day per hour: Enlightened Era

options(tibble.width = Inf)  

EnlightenedEra %>% 
  group_by(Day) %>%
  summarise(
    count = n(),
    sesLengthByDay = round( mean(sesLength),2),
    profitByDay = round(mean(Profit),2),
    profitPerHrByDay = round(profitByDay/sesLengthByDay,2),
    totalProfitByDay = round(mean(totalProfit),2), # totalProfit including promotion earnings
    totalProfitPerHrByDay = round(totalProfitByDay/sesLengthByDay,2)
    ) %>% kable()
Day count sesLengthByDay profitByDay profitPerHrByDay totalProfitByDay totalProfitPerHrByDay
Feb 1 10.78 402.00 37.29 502.00 46.57
Fri 18 6.54 -16.56 -2.53 -16.56 -2.53
Mon 14 5.17 292.00 56.48 292.00 56.48
Sat 3 7.24 -568.00 -78.45 -468.00 -64.64
Thu 11 6.67 285.91 42.87 285.91 42.87
Tue 3 9.54 26.00 2.73 26.00 2.73
Wed 10 5.83 206.70 35.45 226.70 38.89


2. Interactive Visualization

Apply htmlwidget -> highcharter


Initially inspired by Philipp Spachtholz.

Package Author Joshua Kunst’s RPub https://rpubs.com/jbkunst/highcharter.

Additional highcharter learning material by Danton Noriega and Nana Boateng.


A.1 Session Profit (Overall)

#library(highcharter)

series = list(
  list(
    name = 'Total Profit for each session, stratified by stake (lemon chiffon: 1$/2$, peppermint: 1$/3$)',
    color = '#1E90FF', # <http://cloford.com/resources/colours/500col.htm>
    data = Testimate %>% select(totalProfit) %>% .[[1]]
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = Testimate %>% select(Day) %>% .[[1]], # or day
           plotBands = list(
              list(from = -0.5, to = 14.5, color = "#FFFACD"), # may be colored by day 
              list(from = 14.5, to = 15.5, color = "#BDFCC9"),
              list(from = 15.5, to = 16.5, color = "#FFFACD"),
              list(from = 16.5, to = 18.5, color = "#FFFACD"),
              list(from = 17.5, to = 18.5, color = "#FFFACD"),
              list(from = 18.5, to = 19.5, color = "#FFFACD"),
              list(from = 19.5, to = 20.5, color = "#BDFCC9"),
              list(from = 20.5, to = 21.5, color = "#FFFACD"),
              list(from = 21.5, to = 22.5, color = "#BDFCC9"),
              list(from = 22.5, to = 23.5, color = "#FFFACD"),
              list(from = 23.5, to = 24.5, color = "#FFFACD"),
              list(from = 24.5, to = 25.5, color = "#BDFCC9"),
              list(from = 25.5, to = 26.5, color = "#FFFACD"),
              list(from = 26.5, to = 27.5, color = "#FFFACD"),
              list(from = 27.5, to = 28.5, color = "#BDFCC9"),
              list(from = 28.5, to = 29.5, color = "#FFFACD"),
              list(from = 29.5, to = 34.5, color = "#BDFCC9"),
              list(from = 34.5, to = 35.5, color = "#FFFACD")
              )) %>%
  hc_yAxis(plotLines = list(
              list(value = 0, width = 5, color = 'black')
              ))


A.2 Session Profit (1/3)

#library(highcharter)

series = list(
  list(
    name = 'Total Profit for each 1$3$ session',
    color = '#1E90FF', # <http://cloford.com/resources/colours/500col.htm>
    data = Testimate %>% filter(Stake >= 2.5) %>% select(totalProfit)  %>% .[[1]]
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = Testimate %>% select(Day) %>% .[[1]] ) %>%
  hc_yAxis(plotLines = list(
              list(value = 0, width = 5, color = 'black')
              ))


A.3 Session Profit (1/2)

#library(highcharter)

series = list(
  list(
    name = 'Total Profit for each 1$2$ session',
    color = '#1E90FF', # <http://cloford.com/resources/colours/500col.htm>
    data = Testimate %>% filter(Stake < 2.5) %>% select(totalProfit)  %>% .[[1]]
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = Testimate %>% select(Day) %>% .[[1]] ) %>%
  hc_yAxis(plotLines = list(
              list(value = 0, width = 5, color = 'black')
              ))


B.1 Session Profit (Enlightened Era)

series = list(
  list(
    name = 'Total Profit for each session during the Enlightment Era, stratified by stake (lemon chiffon: 1$/2$, peppermint: 1$/3$)',
    color = '#1E90FF', # <http://cloford.com/resources/colours/500col.htm>
    data = EnlightenedEra %>% select(totalProfit) %>% .[[1]]
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = EnlightenedEra %>% select(Day) %>% .[[1]], # or day
           plotBands = list(
              list(from = -0.5, to = 0.5, color = "#FFFACD"), 
              list(from = 0.5, to = 1.5, color = "#BDFCC9"),
              list(from = 1.5, to = 3.5, color = "#FFFACD"),
              list(from = 3.5, to = 4.5, color = "#FFFACD"),
              list(from = 4.5, to = 5.5, color = "#FFFACD"),
              list(from = 5.5, to = 6.5, color = "#BDFCC9"),
              list(from = 6.5, to = 7.5, color = "#FFFACD"),
              list(from = 7.5, to = 8.5, color = "#BDFCC9"),
              list(from = 8.5, to = 9.5, color = "#FFFACD"),
              list(from = 9.5, to = 10.5, color = "#FFFACD"), 
              list(from = 10.5, to = 11.5, color = "#BDFCC9"),
              list(from = 11.5, to = 12.5, color = "#FFFACD"),
              list(from = 12.5, to = 13.5, color = "#FFFACD"),
              list(from = 13.5, to = 14.5, color = "#BDFCC9"),
              list(from = 14.5, to = 15.5, color = "#FFFACD"),
              list(from = 15.5, to = 20.5, color = "#BDFCC9"),
              list(from = 20.5, to = 21.5, color = "#FFFACD")
              )) %>%
  hc_yAxis(plotLines = list(
              list(value = 0, width = 5, color = 'black')
              ))


B.1 Cumulative Profit (Overall)

series = list(
  list(
    name = 'Cumulative Profit',
    color = '#EEAD0E', 
    data = Testimate %>% select(accuProfit) %>% .[[1]]
  ),
  list(
    name = 'Cumulative Total Profit (promo bonus included)',
    color = '#FF7D40', 
    data = Testimate %>% select(accuTotalProfit) %>% .[[1]]
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = Testimate %>% select(Day) %>% .[[1]],
           plotBands = list(
              list(from = -0.5, to = 14.5, color = "#FFFACD"), # may be colored by day 
              list(from = 14.5, to = 15.5, color = "#BDFCC9"),
              list(from = 15.5, to = 16.5, color = "#FFFACD"),
              list(from = 16.5, to = 18.5, color = "#FFFACD"),
              list(from = 17.5, to = 18.5, color = "#FFFACD"),
              list(from = 18.5, to = 19.5, color = "#FFFACD"),
              list(from = 19.5, to = 20.5, color = "#BDFCC9"),
              list(from = 20.5, to = 21.5, color = "#FFFACD"),
              list(from = 21.5, to = 22.5, color = "#BDFCC9"),
              list(from = 22.5, to = 23.5, color = "#FFFACD"),
              list(from = 23.5, to = 24.5, color = "#FFFACD"),
              list(from = 24.5, to = 25.5, color = "#BDFCC9"),
              list(from = 25.5, to = 26.5, color = "#FFFACD"),
              list(from = 26.5, to = 27.5, color = "#FFFACD"),
              list(from = 27.5, to = 28.5, color = "#BDFCC9"),
              list(from = 28.5, to = 29.5, color = "#FFFACD"),
              list(from = 29.5, to = 34.5, color = "#BDFCC9"),
              list(from = 34.5, to = 35.5, color = "#FFFACD")
              ))


B.2 Cumulative Profit (Enlightened)

series = list(
  list(
    name = 'Cumulative Profit in Enlightened Era',
    color = '#EEAD0E', 
    data = EnlightenedEra %>% select(accuProfit) %>% .[[1]]
  ),
  list(
    name = 'Cumulative Total Profit during the Enlightened Era (promo bonus included)',
    color = '#FF7D40', 
    data = EnlightenedEra %>% select(accuTotalProfit) %>% .[[1]]
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = EnlightenedEra %>% select(Day) %>% .[[1]],
           plotBands = list(
              list(from = -0.5, to = 0.5, color = "#FFFACD"), 
              list(from = 0.5, to = 1.5, color = "#BDFCC9"),
              list(from = 1.5, to = 3.5, color = "#FFFACD"),
              list(from = 3.5, to = 4.5, color = "#FFFACD"),
              list(from = 4.5, to = 5.5, color = "#FFFACD"),
              list(from = 5.5, to = 6.5, color = "#BDFCC9"),
              list(from = 6.5, to = 7.5, color = "#FFFACD"),
              list(from = 7.5, to = 8.5, color = "#BDFCC9"),
              list(from = 8.5, to = 9.5, color = "#FFFACD"),
              list(from = 9.5, to = 10.5, color = "#FFFACD"), 
              list(from = 10.5, to = 11.5, color = "#BDFCC9"),
              list(from = 11.5, to = 12.5, color = "#FFFACD"),
              list(from = 12.5, to = 13.5, color = "#FFFACD"),
              list(from = 13.5, to = 14.5, color = "#BDFCC9"),
              list(from = 14.5, to = 15.5, color = "#FFFACD"),
              list(from = 15.5, to = 20.5, color = "#BDFCC9"),
              list(from = 20.5, to = 21.5, color = "#FFFACD")
              ))


C.1 Cumulative Profit per hour Rate (Overall)

series = list(
  list(
    name = 'Cumulative Profit Per Hour',
    color = '#EEAD0E',
    data = Testimate %>% select(accuProfitPerHr) %>% .[[1]] %>% round(2) 
  ),
  list(
    name = 'Cumulative Total Profit Per Hour (promo bonus included)',
    color = '#FF7D40',
    data = Testimate %>% select(accuTotalProfitPerHr) %>% .[[1]] %>% round(2)
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = Testimate %>% select(Day) %>% .[[1]],
           plotBands = list(
              list(from = -0.5, to = 14.5, color = "#FFFACD"), # may be colored by day 
              list(from = 14.5, to = 15.5, color = "#BDFCC9"),
              list(from = 15.5, to = 16.5, color = "#FFFACD"),
              list(from = 16.5, to = 18.5, color = "#FFFACD"),
              list(from = 17.5, to = 18.5, color = "#FFFACD"),
              list(from = 18.5, to = 19.5, color = "#FFFACD"),
              list(from = 19.5, to = 20.5, color = "#BDFCC9"),
              list(from = 20.5, to = 21.5, color = "#FFFACD"),
              list(from = 21.5, to = 22.5, color = "#BDFCC9"),
              list(from = 22.5, to = 23.5, color = "#FFFACD"),
              list(from = 23.5, to = 24.5, color = "#FFFACD"),
              list(from = 24.5, to = 25.5, color = "#BDFCC9"),
              list(from = 25.5, to = 26.5, color = "#FFFACD"),
              list(from = 26.5, to = 27.5, color = "#FFFACD"),
              list(from = 27.5, to = 28.5, color = "#BDFCC9"),
              list(from = 28.5, to = 29.5, color = "#FFFACD"),
              list(from = 29.5, to = 34.5, color = "#BDFCC9"),
              list(from = 34.5, to = 35.5, color = "#FFFACD")
              ))


C.2 Cumulative Profit per hour rate (Enlightened)

series = list(
  list(
    name = 'Cumulative Profit Per Hour during the Enlightened Era',
    color = '#EEAD0E',
    data = EnlightenedEra %>% select(accuProfitPerHr) %>% .[[1]] %>% round(2) 
  ),
  list(
    name = 'Cumulative Total Profit Per Hour during the Enlightened Era (promo bonus included)',
    color = '#FF7D40',
    data = EnlightenedEra %>% select(accuTotalProfitPerHr) %>% .[[1]] %>% round(2)
  )
)

highchart() %>%
  hc_add_series_list(series) %>% 
  hc_xAxis(categories = EnlightenedEra %>% select(Day) %>% .[[1]],
           plotBands = list(
              list(from = -0.5, to = 0.5, color = "#FFFACD"), 
              list(from = 0.5, to = 1.5, color = "#BDFCC9"),
              list(from = 1.5, to = 3.5, color = "#FFFACD"),
              list(from = 3.5, to = 4.5, color = "#FFFACD"),
              list(from = 4.5, to = 5.5, color = "#FFFACD"),
              list(from = 5.5, to = 6.5, color = "#BDFCC9"),
              list(from = 6.5, to = 7.5, color = "#FFFACD"),
              list(from = 7.5, to = 8.5, color = "#BDFCC9"),
              list(from = 8.5, to = 9.5, color = "#FFFACD"),
              list(from = 9.5, to = 10.5, color = "#FFFACD"), 
              list(from = 10.5, to = 11.5, color = "#BDFCC9"),
              list(from = 11.5, to = 12.5, color = "#FFFACD"),
              list(from = 12.5, to = 13.5, color = "#FFFACD"),
              list(from = 13.5, to = 14.5, color = "#BDFCC9"),
              list(from = 14.5, to = 15.5, color = "#FFFACD"),
              list(from = 15.5, to = 20.5, color = "#BDFCC9"),
              list(from = 20.5, to = 21.5, color = "#FFFACD")
              ))

highcharter might be outdated on CRAN. Install from github directly by

library(devtools)
install_github("jbkunst/highcharter")