Graphing Populations

Graph the data, Graph the data, Graph the data.....Here is a graphing method I've found useful when looking at data sets.

#Simple

#set the dir to where you mydata is

setwd("c:/R")

#LOAD DATA NOTE a copy of the data is attached below on this web page.

mydata <- read.table("example-data.csv", header=TRUE, sep=",",)

# Here we tell it we are going to do 3 graphs in 3 rows and 1 column

par(mfrow=c(3,1))

#NOTCHED BOX PLOT

boxplot(mydata$MW01, notch=TRUE,

# Now we are going to put it on its side

horizontal=TRUE,

# Gives the title and axis names

main="Title", xlab="Box X-Lab", ylab="axis label = Y-Lab",

#Sets the colors

col=(c("gold","darkgray", "darkorchid1", "cyan", "white", "red","limegreen", "magenta", "chartreuse1", "hotpink1")))

#DENSITY PLOT

d <- density(mydata$MW01)

# Gives the title

plot(d, main="Denisty Plot Title")

polygon(d, col="red", border="blue")

#HISTOGRAM NOTE you can add breaks=x into the line below and set the number of bins.

hist(mydata$MW01, xlab="Hist X Lab", main="Histogram of X", col="red")

# Done

# Done

Below is the spreadsheet. All you have to do to do another column of data is change $MW01 to the column you need.