so I got 2 plots, that work perfectly fine on their own. I'm trying to show them side by side, bars next to each other as pretty as possible, but it's just not working out. Trying to compare past and current food expenditure of some 600 people.
ggplot(data=survey,aes(x=Past.FoodExp))+
geom_bar()+
geom_text(stat ='count',aes(label =..count.., vjust = -0.2))
ggplot(data=survey,aes(x=Current.FoodExp))+
geom_bar()+
geom_text(stat ='count',aes(label =..count.., vjust = -0.2))
This is what I tried, but it didn't give me a result I wanted.
ggplot(data=survey, aes(y=Past.foodExp, x=Current.FoodExp)) +
geom_bar(position="dodge", stat="identity")
As you can see, it shows my ranges on both x and y axes, and I need it on only x, while y being the total count of people I surveyed. Any of you got an idea how to go around this and present it properly? Thanks.
Reproducible example
dput(head(survey,10))
structure(list(Past.FoodExp = structure(c(2L, 1L, 3L, 4L, 3L,
4L, 3L, 4L, 3L, 3L), .Label = c("0-100\x80", "101-200\x80", "201-300\x80",
"300\x80+"), class = "factor"), Current.FoodExp = structure(c(2L,
2L, 4L, 4L, 3L, 3L, 4L, 4L, 4L, 4L), .Label = c("0-100\x80",
"101-200\x80", "201-300\x80", "300\x80+"), class = "factor")), row.names = c(NA,
10L), class = "data.frame")