Plotly project

Sarah Shikangah

June 21, 2017

ABSTARCT

The goal of this project is to create a web page presentation of the prediction of the wholesale imports since 2010 to 2016. Data was obtained from the site https://datahub.io/dataset/predicting-wholesale-imports-by-region-of-onion/resource/5e6a58bf-110f-497a-b9da-0f69c707e965. R Mardown will be used in conjunction with Plotly.

Objectives

Required packages

library(plotly)
library(ggplot2)

Get and clean data

Download dataset from datahub website as shown below;

adf <- read.csv("https://datahub.io/dataset/dfa62f19-ce70-42a4-9667-6a62603da9a8/resource/5e6a58bf-110f-497a-b9da-0f69c707e965/download/302extract1.csv")
# get random sampling n=30
samp <- adf[sample(nrow(adf), 30),]
#Drop unwanted variables and format date
samp <- samp[, -c(3:5)]
samp$DATA.trade_ymd <- as.Date(samp$DATA.trade_ymd)
head(samp)
##        rowkey DATA.trade_ymd DATA.trade_volume DATA.ym
## 32900      NA     2010-05-17              8246 2010 05
## 1043       NA     2010-10-16             12750 2010 10
## 243970     NA     2015-04-25             32000 2015 04
## 225926     NA     2015-01-16                40 2015 01
## 233        NA     2010-11-20              1744 2010 11
## 287026     NA     2016-08-27              5420 2016 08

Plot the trend of wholesale imports since 2010 to 2016

 plot_ly(x = ~samp$DATA.trade_ymd, y =~ samp$DATA.trade_volume)