Hi,
I need to plot bars and line using the data frame named mydata2.
I am able to plot only bars using :
However, I need to plot using geom_bar the data related to "inc. cok" and "inc. in", but also, graph using geom_line "Vari".
If anyone knows the way, please give me a hand.
I've reading a lot of web links but I am stuck interpreting the code.
Thank you for your time and interest
I need to plot bars and line using the data frame named mydata2.
I am able to plot only bars using :
Code:
library(ggplot2)
p <-ggplot(mydata, aes(as.character(months), y=values))
p +geom_bar(stat = "identity", aes(fill = type), width = 0.6, position="dodge")+
xlab("trimestres")+
ylab("Incidencias (pp.)")+
theme(legend.position = "top",
legend.justification = "left",
legend.direction = "horizontal",
legend.title = element_blank(),
legend.key.size = unit(0.5,"line"))
summary(mydata2)
months values type
Min. :201708 Min. :-2.09614 inc. cok :25
1st Qu.:201802 1st Qu.:-0.56529 inc. in :25
Median :201808 Median : 0.00099 Vari :25
Mean :201819 Mean : 0.03232
3rd Qu.:201902 3rd Qu.: 0.47003
Max. :201908 Max. : 2.36371
If anyone knows the way, please give me a hand.
I've reading a lot of web links but I am stuck interpreting the code.
Thank you for your time and interest