I am trying to make a plot with ggplot2 and i cannot really get my head around how to do it.
My df is laid out like the below:
I would want the graph to show the X axis with the Area name with a bar chart of each of the column headings, I am able to do it for one of them but i am unsure how to combine them together.
Or I have seen facet_wrap been used which could create a graph for each area name and the 4 bars with their corresponding values in each facet.
This is what I have come up with so far...
wlcalcs %>% ggplot(aes(y= `80+ % d1`, x= `Area`)) + geom_bar(stat='identity')
So I have combined the fields I need into two new fields on my dataframe called "New" and "Values" this is my updated ggplot2 code below but doesnt seem to work for whatever reason. My New field is effectively 80+ %d1 X with x corresponding to its value line by line.
I want a facet for each Area name and I want the values of 'New' to be my X axis and values of 'Y' (the percentages) to be the fill for each of them bars.
I am probably doing somethign wrong but i hope im on teh right track
test1 <- ggplot(data = test) +
geom_bar(mapping = aes(x = `New`, y = `Values`)) +
facet_wrap(~ group_by(`Ward Name`, nrow = 2))
Any help is appreciated, this is the first time i have used R pretty much and first time trying plots out. I assume some combined field needs to be done as I have had a search around but cannot really understand it too well