I've been trying for the last couple of weeks to set up a graph that i need. I want to try to have multiple variables (V2, V5, V6) on the "x" axis and how they differ by another condition (V4).
My data looks like this:
v1 v2 v3 v4 v5 v6
2 1 214 2 3 1
2 1 214 2 4 1
3 1 214 2 2 1
4 1 214 2 3 1
1 1 372 1 1 2
3 1 552 1 2 1
The chart i have been albe to make looks like the one on the bottom here but i would like to try to make one like on the top. https://i.stack.imgur.com/Dc8o7.jpg
So far my bar chart code is like this:
ggplot(oll_subset, aes(factor(v2), fill = factor(v4))) +
geom_bar(position = "dodge")
ggplot(oll_subset, aes(factor(v4), fill = factor(v2))) +
geom_bar(position = "dodge")
#NOT WORKING
#graph <- ggplot(oll_subset, aes(v2, v4))
#graph + geom_bar()
#graph + geom_bar(factor(x=v4))
g <- ggplot(oll_subset, aes(v2))
g + geom_bar()
g + geom_bar(aes(fill = v4))