9 9 2014 Distribution Overlay Graphs in R for Size Data
DistributionOverlayGraphs.R
DistributionOverlayGraphs.R
Jake H
Tue Sep 09 12:57:14 2014
library(ggplot2)
#ggplot2 makes the distribution curve graphs
library(car)
#not sure what car does but I think it works with lattices
library(splitstackshape)
## Loading required package: data.table
#splitstackshape is an easy package that can help you split columns that have delimiters,
#Original CSV file column labelled "Tray" had entries that needed to be split
picsize5=read.csv('ImageJsize4.csv')
#creates dataframe and reads in the CSV file for sizes
picsize6<-concat.split.multiple(picsize5, "Tray", " ")
#splits the Tray column into Tray_1 with Site Number and Tray_2 with Tray number
foys<-subset(picsize6, Date=="2/26/2014"& Site=="Oyster Bay")
#creates a subset data frame for just the size data from February 26th at Oyster Bay
ggplot(foys, aes(x=Length.mm))+geom_density(aes(group=Tray_1, colour=Tray_1, fill=Tray_1),alpha=0.3)
#creates distribution graph overlays for all populations in Feb at Oyster Bay. Looks cool.
fman<-subset(picsize6, Date=="2/26/2014"& Site=="Manchester")
ggplot(fman, aes(x=Length.mm))+geom_density(aes(group=Tray_1, colour=Tray_1, fill=Tray_1),alpha=0.3)
No comments:
Post a Comment