The purpose of this post is to learn to make bar graphs in R. As practice, I used the public data of the demographics within Toronto’s many neighborhoods. R found four neighborhoods with the greatest percent of population speaking Chinese, Tamil and Tagalog. Results show that visible minorities tend to live close to each other, just outside of the downtown core of a major city.
|Languages in Toronto by Neighborhood
Cross referencing with Google Earth shows that, with regards to Chinese speakers, the neighborhoods were in the Northeast end of Toronto. For Tamil speakers, prominent neighborhoods were in the East end. For Tagalog, prominent neighborhoods were in the North end. Public data came from a 2011 survey conducted by Wellbeing Toronto, a program with the City of Toronto. I attached a link to all Excel and coding files.
For the coding, I had to learn to create bar graphs using the barplot function, create columns in a dataset and order values by size. My coding is as follows:
#Language in Toronto
#By Matthew Mano
Import the file
Create three additional columns with the percent population
Order the percent population by decreasing size
Display 3 charts in 1 window
barplot(height=lang.newch$PCh[1:4],names.arg=lang.newch$Ne[1:4],ylab=“Percent out of Total Population (%)”,border=NA)
Create a barplot of the first four neighborhoods for Chinese speakers. Did the same for the other two languages.
title(main=“Toronto Neighborhoods with the Greatest Percent of Chinese Speakers”)
barplot(height=lang.newtl$PTl[1:4],names.arg=lang.newtl$Ne[1:4],ylab=“Percent out of Total Population (%)”,border=NA)
title(main=“Toronto Neighborhoods with the Greatest Percent of Tamil Speakers”)
barplot(height=lang.newtg$PTg[1:4],names.arg=lang.newtg$Ne[1:4],ylab=“Percent out of Total Population (%)”,border=NA)
title(main=“Toronto Neighborhoods with the Greatest Percent of Tagalog Speakers”,)
Link for downloads: http://bit.ly/20xMtvZ