I am new to R and am trying to make a series of plots.
I have a table similar to the following (but much larger):
CITY LOCATION NUMBER_OF_PUBS BEER
Cardiff Wales 100 Brains
Newport Wales 50 Brains
Aberystwyth Wales 400 Brains
Edinburgh Scotland 220 Belhaven
St_Andrews Scotland 20 Belhaven
Aberdeen Scotland 800 Belhaven
Bath England 500 London_Pride
London England 10 London_Pride
Bristol England 200 London_Pride
Birmingham England 100 London_Pride
Dublin Ireland 250 Guinness
Cork Ireland 60 Guinness
Galway Ireland 750 Guinness
Limerick Ireland 150 Guinness
I am trying to plot a box and whisker plot of location against number of pubs:
But I want to just plot a subset of these locations. For example just those found in Wales and Scotland from the location column.
I have found this thread: GGPLOT2: how to plot specific selections inthe ggplot() script
and tried this:
t <- as.data.frame(pubs)
ggplot(t, aes(NUMBER_OF_PUBS, LOCATION , fill = factor(BEER))) +
geom_boxploth(t=subset(t,COHORT="Wales", "Scotland"))
But seem to be getting no where...
I am sure its very simple but just can't seem to work it out. Any help would be greatly appreciated. Thank you.