Created
March 26, 2011 12:20
-
-
Save ogra/888232 to your computer and use it in GitHub Desktop.
Ukraine population pyramid 1985
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(plotrix) | |
data = read.csv("UNPop_ukraine_age_sex_1985-2010.csv") | |
data = data[-379, ] | |
data1 = subset(data, select=c("Sex", "Year", "Age", "Value")) | |
xy.pop1985 = subset(data1[data1$Sex=="Male" & data1$Year==1985,], select="Value")$Value | |
xx.pop1985 = subset(data1[data1$Sex=="Female" & data1$Year==1985,], select="Value")$Value | |
agelabels = unique(subset(data1, select="Age")$Age) | |
xx.pop1985ratio = xx.pop1985 / sum(xx.pop1985) * 100 | |
xy.pop1985ratio = xy.pop1985 / sum(xy.pop1985) * 100 | |
par(mar=pyramid.plot(xy.pop1985ratio,xx.pop1985ratio,labels=agelabels,main="Ukraine population pyramid 1985",gap=1.5,show.values=TRUE)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
header = TRUE by default with read.csv()