Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- data <- read.csv(file = "population.csv", header = TRUE, sep = ,) ##import data file
- a <- split(data,list(state)) ##split factor state into individual states
- x <- c("Census", 2010, 2011, 2012, 2013, 2014) ##set x axis tick mark labels to placeholder variable
- y <- axTicks(2)
- plot(a$Alabama$Population, type = "o", xlab = "Year", ylab = "Population (millions)", xaxt="n", yaxt="n")
- title(main = "Population Growth - Alabama: 2010 - 2014") ##add main title
- axis(1, at = 1:6, labels = x) ##place x axis tick marks
- axis(2, las = 1, at = seq(min(y),max(y),(max(y)-min(y))/2), labels = c(round(min(y),2),round((max(y)+min(y))/2,2),round(max(y),2)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement