I recently started programming in R and I am trying to plot several columns using ggplot2.
My data frame looks like this:
mydf <- data.frame(Names, Less, Equal, More)
mydf
Names Less Equal More
1 Sarah 8 25 8
2 Mark 13 13 13
3 Peter 11 26 5
And to give an idea of how I created this data frame, 'Less' looks like this:
[1] 8 13 11
I want to be able to compare for every name if their scores are less, equal, or more. On the x-axis, I actually want to plot "More", "Less", and "Equal", with different bars for each name. On the y-axis I want to print the score (e.g. 8, 25...). I want to create multiple bars for each name.
I have tried several things, but I have only succeeded in adding a single value on the y-axis:
test <- ggplot(mydf, aes(x= Names, y= More)) +
geom_bar(stat = "identity")
I have a feeling that the problem lies with the way my data is organised, but I am not sure.
