28/06/2021

Instructions

Create a web page presentation using R Markdown that features a plot created with Plotly. Host your webpage on either GitHub Pages, RPubs, or NeoCities. Your webpage must contain the date that you created the document, and it must contain a plot created with Plotly. We would love to see you show off your creativity!

Criteria

The rubric contains the following two questions:

  1. Does the web page feature a date and is this date less than two months before the date that you’re grading this assignment?
  2. Is the web page a presentation and does it feature an interactive plot that appears to have been created with Plotly?

My Submission

I chose to plot from the UKDriverDeaths built-in data set and to host the page on RPubs, here I load the libraries and data set.

library(plotly)
library(zoo)
library(magrittr)
data("UKDriverDeaths")

Data wrangle

I found that ploy_ly() does not handle a time-series object, I had to create a data.frame with 2 variables, Date and Deaths. I used the as.Date() function from the zoo library as the base function did not do what i needed.

The Plot

Conclusion

This data set is relevant as in 1983 it became law for all UK drivers to wear seatbelts, this graph shows a clear reduction in the number of UK road deaths after this the law was enacted.