I am doing an assignment where I need to create a histogram. That is no problem and I have been able to do this for the whole data set. I can not get it to do it for each year whatever I try.
(c) For every year from 2008 to 2011 plot a histogram as well as a bar graph of gdp per capita using a “for”-loop.
I know this isn't correct but this is my most recent attempt:
for (combined$year in 2008) {
hist(combined$GDP_fixprices_fixPPP/combined$pop,
main="Histogram of GDP per capita",
xlab="GDP per Capita",
border="blue",
col="green",
las=1,
breaks=5)
}
My dataset is called combined