Skip to content

Instantly share code, notes, and snippets.

@Thermoflux
Created January 29, 2017 21:56
Show Gist options
  • Save Thermoflux/90e052535d16a3114dfd7d06dbb8e544 to your computer and use it in GitHub Desktop.
Save Thermoflux/90e052535d16a3114dfd7d06dbb8e544 to your computer and use it in GitHub Desktop.
name = "Histogram of US"
extn = ".jpeg"
name = paste(name,extn)
jpeg(name)
par(mfrow=c(3, 1))
for (i in c(1,3)) {
tempvar2 <- Crime[,c(132,130,136)]
colnames <- colnames(tempvar2)
hist(as.numeric(tempvar2[,i]), xlim=c(0, max(as.numeric(tempvar2[,i])+10)), breaks=seq(0, max(as.numeric(tempvar2[,i])+10), 10),
main=colnames[i], probability=TRUE, col=i*2, border="black",xlab=colnames[i])
}
tempvar3 <- subset(tempvar2,tempvar2$murders>100)
i = 2
hist(as.numeric(tempvar3[,1]), xlim=c(0, max(as.numeric(tempvar3[,1])+10)), breaks=18,
main=colnames[i], probability=TRUE, col=i*2, border="black",xlab=colnames[i])
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment