# .libPaths('R:/equity_quant/brianb/r/librarydev')
#Packages
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(highcharter)
## Highcharts (www.highcharts.com) is a Highsoft software product which is
## not free for commercial and Governmental use
library(tidyr)
GolfData = read.delim('R:/Equity_Quant/BrianB/R/Misc/Day2_part1.csv',
sep=',',
header=TRUE,
skip = 1,
stringsAsFactors = FALSE)
temp <- read.delim('R:/Equity_Quant/BrianB/R/Misc/Day2_part2.csv',
sep=',',
header=TRUE,
skip = 1,
stringsAsFactors = FALSE)
GolfData <- rbind(GolfData,temp)
GolfData$Club = ''
GolfData$Club[1:9] = '5 Iron'
GolfData$Club[10:20] = '7 Iron'
GolfData$Club[21:29] = '9 Iron'
GolfData$Club[30:40] = 'Gap Wedge'
GolfData$Club[41:48] = 'Lob Wedge'
GolfData$Club[49:60] = 'Driver'
GolfData$Club[61:71] = '3 Iron'
#GolfData$Total <- GolfData$Total *1.05
#Modify 3 Iron for shot run - Uneekor roll on 3 iron is inaccurate
GolfData <- GolfData %>% mutate(Total = if_else(Club=='3 Iron',Total*1.05,Total))
sysAlphaTheme <- hc_theme_merge(hc_theme_darkunica(),
hc_theme(chart = list(style = list(fontFamily = "Roboto", textTransform = "none")),
title = list(style = list(fontFamily = "Roboto",textTransform = "none")),
subtitle = list(style = list(fontFamily = "Roboto",textTransform = "none"))))
MyLine <- data.frame(xval=c(0,0),yval=c(0,350))
hc <- highchart() %>%
hc_add_series(GolfData,"scatter",hcaes(x=SideTotal,y=Total,group=Club)) %>%
hc_add_series(MyLine,"line",hcaes(x=xval,y=yval),color="white",name="") %>%
hc_yAxis(max=350,title=list(text = "Distance in yards")) %>%
hc_xAxis(min=-80,max=80,title = list(text = "Distance off line")) %>%
hc_title(text = "Uneekor Range Session #2") %>%
hc_add_theme(sysAlphaTheme)
hc