How did I do as far as being on the leaderboard?

leaderboard<- read.csv(‘C:/leaderboards_timechange.csv’)# change filepath accordingly and uncomment this line

leaderboard_linechart <- ggplot(data=leaderboard, aes(x=date, y=score))

leaderboard_linechart + 
  geom_point(color= 'orangered')+
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank())

This x axis is incomprehensible. Look at how the dates are all jumbled together. Let’s look at the year instead.

View(leaderboard)

leaderboard$date <- as.Date(leaderboard$date)

leaderboard$year <- as.numeric(format(leaderboard$date, "%Y"))

Now let’s look at the year

leaderboard_groupedby_year <- sqldf("SELECT DISTINCT year, SUM(score) AS TOTAL_SCORE
                                    FROM leaderboard
                                    GROUP BY year")
leaderboard_groupedby_year
##   year TOTAL_SCORE
## 1 2019        1235
## 2 2020        1113

Visualizing the Data

leaderboard_barchart <- ggplot(data=leaderboard_groupedby_year, aes(x=year, y=TOTAL_SCORE))

leaderboard_barchart + 
  geom_col(color= c('orangered','blue'),fill=c('orangered','blue'))+
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank())+
  theme_void()+
  labs(title= "Total Score for 2019 (Orange) and 2020 (Blue)")+
  geom_text(aes(label = TOTAL_SCORE), 
            position = position_dodge(0.9),
            vjust = -0.5,
            size =5,
            color=c('orangered','blue'))

Visualizing the Data by Month

head(leaderboard)
##   leaderboard       date timestamp tier score year
## 1     leagues 2019-05-18  20:00:35    0    20 2019
## 2     leagues 2019-05-20  11:14:16    0    50 2019
## 3     leagues 2019-05-27  12:41:58    0    60 2019
## 4     leagues 2019-06-03  11:58:17    0    40 2019
## 5     leagues 2019-06-10  22:35:45    0    50 2019
## 6     leagues 2019-06-17  11:36:58    0    40 2019
leaderboard_linechart <- ggplot(data=leaderboard, aes(x=date, y=score))

leaderboard_linechart + 
  geom_line(color= c('cornflowerblue'),size =1)+
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),panel.background = element_blank())+
  labs(title= "Score Over Time for 2019 through 2020")

It looks like I reached my highest peak in my score at the beginning of 2020. What was that score?

sqldf("SELECT date, MAX(score) AS HIGHEST_SCORE
       FROM leaderboard 
       ")
##         date HIGHEST_SCORE
## 1 2020-01-27           109

109 was my highest score on ‘2020-01-27’, however, as we discovered. I showed a greater total score for 2019.