##Task Description 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!
##Solution In this work we plot average monthly exchange rates, against the USD, from January 2015 to October 2020 for 8 African countries namely Zambia,Malawi,Angola,Congo(Kinshisa),Zimbabwe,Tanzania,Namiba and Botswana.
###load and plot
library(dplyr)
## Warning: package 'dplyr' was built under R version 3.6.3
##
## 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(tidyr)
## Warning: package 'tidyr' was built under R version 3.6.3
library(plotly)
## Warning: package 'plotly' was built under R version 3.6.3
## Loading required package: ggplot2
## Warning: package 'ggplot2' was built under R version 3.6.3
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(data.table)
##
## Attaching package: 'data.table'
## The following objects are masked from 'package:dplyr':
##
## between, first, last
library(zoo)
## Warning: package 'zoo' was built under R version 3.6.3
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
library(lubridate)
## Warning: package 'lubridate' was built under R version 3.6.3
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:data.table':
##
## hour, isoweek, mday, minute, month, quarter, second, wday, week,
## yday, year
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
setwd("H:/coursera/data-science/part 9/week 3")
data <- read.csv("hostorical_exchange_rates.csv", colClasses = "character")
#
df <- as.data.frame(data)
drop <- c("Month")
keep <- c("Month")
time = df[, keep,drop = FALSE]
#time$Month <- rbind(time$Month,time$Month)
#time$Month <- rbind(time$Month,time$Month)
rates <- df[, !(names(df) %in% drop)] %>%
gather(index,rate)
rates$month <- parse_date_time(time$Month, "my")
plot_ly(rates,x=rates$month,y=rates$rate,color = rates$index) %>%
add_lines()
## Warning: `arrange_()` is deprecated as of dplyr 0.7.0.
## Please use `arrange()` instead.
## See vignette('programming') for more help
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_warnings()` to see where this warning was generated.