I'm having a hard time to plot this in the right way:
data.frame':181 obs. of 3 variables:
Profissão: Factor w/ 2 levels "Médico","Enfermeiro": 1 1 1 1 2 1 1 2 2 1 ...
social: num 25 32 34 29 29 40 38 31 33 35 ...
Servico: Factor w/ 2 levels "HMPB","HMU": 2 2 2 2 2 2 2 2 2 2 ...
Profissão social Servico
1 Médico 25 HMU
2 Médico 32 HMU
3 Médico 34 HMU
4 Médico 29 HMU
5 Enfermeiro 29 HMU
6 Médico 40 HMU
mean(df$social[df$Profissão=="Médico" & df$Servico=="HMPB"])
30.68421
mean(df$social[df$Profissão=="Médico" & df$Servico=="HMU"])
28.83333
ggplot(df, aes(Profissão, social)) +
geom_bar(aes(fill = factor(Servico)), stat="identity", position = "dodge")
But ggplot is resulting this:
image is here: https://www.dropbox.com/s/f0t5q3ll9m2ez6x/ggplot2.PNG?dl=0