library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.3
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.0.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(scales)
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 4.0.3
setwd("/Users/Joeyc/Documents/School/Fall 2021/Data 110/DataSets/")
getwd()
## [1] "C:/Users/Joeyc/Documents/School/Fall 2021/Data 110/DataSets"
CC = read.csv("CryptoCurrencies.csv")
CC$Date <- as.Date(CC$Date, format = "%m/%d/%Y")
typeof(CC$Date)
## [1] "double"
class(CC$Date)
## [1] "Date"
CC$Close <- as.numeric(CC$Close)
## Warning: NAs introduced by coercion
CC$Open <- as.numeric(CC$Open)
## Warning: NAs introduced by coercion
CC$High <- as.numeric(CC$High)
## Warning: NAs introduced by coercion
CC$Low <- as.numeric(CC$Low)
## Warning: NAs introduced by coercion
CC$Adj.Close <- as.numeric(CC$Adj.Close)
## Warning: NAs introduced by coercion
CC$Volume <- as.numeric(CC$Volume)
## Warning: NAs introduced by coercion
CC$Currency <- CC$ï..Currency
View(CC)
CC_Graph <- ggplot(data = CC, aes(x= Date, y= Close, color = Currency))+
geom_line()+
scale_x_date(date_labels = "%Y")+
scale_y_continuous(labels=scales::dollar_format())+
theme_clean()+
ylab("Price")+
xlab("Year")+
ggtitle("Cryptocurrencies Price Change from 2015 to 2021")
CC_Graph
### I was curious how these cryptocurrencies produced before the year 2017. I chose 2017 because BTC has it’s first bubble in 2018 so I wanted to know how it performed before this $20k bubble. I chose a facet wrap to get a sense of the other currencies around this time as well. To see if they even played a role. As you can see ADA and BNB were not even created by 2017. While XRP was in it’s infancy at under 1 cent.
CC2015 <- CC %>%
filter(Date < '2017-01-01')
CC2_Graph <- ggplot(data = CC2015, aes(x= Date, y= Close, color = Currency))+
geom_line()+
facet_wrap(~Currency, scales = "free")+
scale_x_date(date_labels = "%m-%Y")+
scale_y_continuous(labels=scales::dollar_format())+
theme_clean()+
ylab("Price")+
xlab("Date")+
ggtitle("Cryptocurrencies Price Change from 2015 to 2017")
CC2_Graph
CC3_Graph <- ggplot(data = CC, aes(x= Date, y= Close))+
geom_line()+
facet_wrap(~Currency, scales = "free")+
scale_x_date(date_labels = "%m", limits = c(as.Date("2021-1-01"), as.Date("2021-10-01")))+
scale_y_continuous(labels=scales::dollar_format())+
ylab("Price")+
xlab("Date")+
ggtitle("Cryptocurrencies Price Change in 2021")
CC3_Graph
## Warning: Removed 1937 row(s) containing missing values (geom_path).
CC1 <- filter(CC, Currency!='BTC')
CC4_Graph <- ggplot(data = CC1, aes(x= Date, y= Close, color = Currency))+
geom_line()+
scale_x_date(date_labels = "%Y")+
scale_y_continuous(labels=scales::dollar_format())+
theme_clean()+
ylab("Price")+
xlab("Year")+
ggtitle("Cryptocurrencies Price Change from 2015 to 2021")
CC4_Graph
CC2 <- filter(CC1, Currency!='ETH')
CC5_Graph <- ggplot(data = CC2, aes(x= Date, y= Close, color = Currency))+
geom_line()+
scale_x_date(date_labels = "%Y")+
scale_y_continuous(labels=scales::dollar_format())+
theme_clean()+
ylab("Price")+
xlab("Year")+
ggtitle("Cryptocurrencies Price Change from 2015 to 2021")
CC5_Graph
CC3 <- filter(CC2, Currency!='BNB')
CC6_Graph <- ggplot(data = CC3, aes(x= Date, y= Close, color = Currency))+
geom_line()+
scale_x_date(date_labels = "%Y")+
scale_y_continuous(labels=scales::dollar_format())+
theme_clean()+
ylab("Price")+
xlab("Year")+
ggtitle("ADA and XRP Price Change from 2015 to 2021")
CC6_Graph
CCBTC2021 <- CC%>%
filter(Date > '2021-01-01')%>%
filter(Currency == 'BTC') %>%
mutate(Close = Close/20000)
CCADA2021 <- CC%>%
filter(Date > '2021-01-01')%>%
filter(Currency == 'ADA')
CCXRP2021 <- CC%>%
filter(Date > '2021-01-01')%>%
filter(Currency == 'XRP')
CCETH2021 <- CC%>%
filter(Date > '2021-01-01')%>%
filter(Currency == 'ETH') %>%
mutate(Close = Close/1000)
CCBNB2021 <- CC%>%
filter(Date > '2021-01-01')%>%
filter(Currency == 'BNB') %>%
mutate(Close = Close/200)
CC8_Graph <- ggplot(NULL, aes(x= Date, y= Close, col = Currency))+
geom_line(data = CCBTC2021, size=1)+
geom_line(data = CCADA2021, size=1)+
geom_line(data = CCXRP2021, size=1)+
geom_line(data = CCETH2021, size=1)+
geom_line(data = CCBNB2021, size=1)+
scale_x_date(date_labels = "%m-%Y")+
scale_y_continuous(labels=scales::dollar_format())+
theme_clean()+
ylab("Scaled Price")+
xlab("Date")+
ggtitle("Scaled Price Change in 2021")
CC8_Graph
####Something I wanted to show but could not figure out is the % change during 2021 instead of just scaling it myself. I feel like my data is not 100% accurate but it was as close as I could get to showing what I wanted to show.