Hello,
I'm trying to create a chart from a list, but I'm not getting it.
The downloading part works perfectly:
# download adj. price data - Asset[1],Asset[2]...
symbols= c("TIET4.SA","BVMF3.SA", "CCRO3.SA","ITUB4.SA","WIZS3.SA")
Asset = list()
for (symbol in symbols)
Asset[[symbol]] = as.zoo(download_data(symbol, start_date, end_date))
When I try to generate the graph with this code:
# Visualiza gráficos da carteira
for(i in 1:length(symbols)){
plot(Asset[i], main=asset1, col=2, xlab="Período",
ylab="Preço",type="l")
}
I get the following error:
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
I have seen some posts showing the same error, but I could not understand or reproduce the answers that were given. I'm not experienced in R!
Could someone help?
Thanks,