Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion 02-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
We use [coinmarketcap](https://coinmarketcap.com) to verified top 5 cryptocurrencies by market cap, and then pulled each cryptocurrency dataset from yahoo finance, including 1 year long trading information (2021 May - 2022 May).

```{r}
library(tidyverse)
library(ggplot2)
library(coinmarketcapr)
coinmarketcapr::setup('6a34456f-8a3c-46d5-b07f-6b84e364929c')
plot_top_currencies(currency = "USD", k = 5, bar_color = "grey")
Expand All @@ -17,6 +19,18 @@ USDC <- read.csv("data/USDC-USD.csv")
USDT <- read.csv("data/USDT-USD.csv")
```


```{r}
df.close<-data.frame(cbind(BTC[,1],BTC[,6],BNB[,6],ETH[,6],USDC[,6],USDT[,6]))
colnames(df.close)<-c("Date","BTC","BNB","ETH","USDC","USDT")
df.close
```
```{r}
df.close1<- gather(df.close[,2:6], cryptocurrency, price)
df.close1$price<-as.numeric(df.close1$price)
df.close1
ggplot(df.close1, aes(cryptocurrency, price)) +
geom_boxplot() + coord_flip() +
theme_grey(16)
```