Nov, 19, 2017

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.

Review criteria : The rubric contains the following two questions:

  • Does the web page feature a date and is this date less than two months before the date that you're grading this assignment?

  • Is the web page a presentation and does it feature an interactive plot that appears to have been created with Plotly?

Natural Gas Prices Data

Time series of major Natural Gas Prices including US Henry Hub. Data comes from U.S. Energy Information Administration EIA

Dataset contains Monthly prices of Natural gas, starting from January 1997, including April 2016. Prices are in nominal dollars per Million Btu.

License : Public domain and use of EIA content

Data sourced from : https://github.com/datasets/natural-gas-prices

Getting Data & Preparing Plot

sourceData <- read.csv("natural-gas-monthly.csv", 
                       stringsAsFactors = FALSE)
head(sourceData)
##         Date Price
## 1 1997-01-15  3.45
## 2 1997-02-15  2.15
## 3 1997-03-15  1.89
## 4 1997-04-15  2.03
## 5 1997-05-15  2.25
## 6 1997-06-15  2.20
## Assigning titles to X & Y axis.
x <- list(title = "Years")
y <- list(title = "Price in USD")

Plot of Natural Gas Prices using Plotly

plot_ly(sourceData, x = ~as.Date(Date), y = ~Price, type = 'scatter', 
        mode = 'lines') %>% layout(xaxis = x, yaxis = y)