I'm trying to create a for using ggplot:
Carteira<-cbind(A, B, C,D,E,F)
A, B, C, D, E, F are data in the "zoo" format.
My code is:
for(i in 1:6){
ggplot(Carteira[,i], aes(Carteira[,i])) +
geom_histogram(aes(y =..density..),
breaks=seq(-20, 20, by = 2),
col="black",
fill="blue",
alpha = .1) +
geom_density(col=1) +
labs(title="Histogram ") +
labs(x="Returns", y="Count") +
xlim(c(-20,20))
}
The curious thing is that nothing happens. No error message appears. Where am I going wrong?