I built this code to check the correlation between Bitcoin and other altCoins, the table data is working fine, my only issue is when I try to plot the result to get a visual representation, I get the below result:
library(tidyverse)
library(tidyquant)
library(timetk)
library(tibbletime)
library(corrr)
symbols <- c("BTC-USD","ETH-USD","TRX-USD","EOS-USD","ADA-USD")
prices <- getSymbols(symbols,
src = 'yahoo',
from = "2019-09-01",
to = "2020-03-24",
auto.assign = TRUE,
warnings = FALSE) %>%
map(~Ad(get(.))) %>%
reduce(merge) %>%
`colnames<-`(symbols)
prices_monthly <- to.monthly(prices, indexAt = "last", OHLC = FALSE)
prices_monthly %>% correlate() %>% focus('BTC-USD') %>%
ggplot(aes(x = rowname, y = 'BTC-USD')) +
geom_bar(stat = "identity") +
ylab("Correlation with BTC-USD") +
xlab("Variable")
What did I did wrong, please?
