The narrative text can go in here and between the code chunks. Then you can knit the paper to PDF (or use make
) and you’ve got a (more) easily reproducible paper.
source("temperature-plots.R", print.eval = TRUE, echo = TRUE)
##
## > require(plyr)
## Loading required package: plyr
##
## > require(ggplot2)
## Loading required package: ggplot2
##
## > setwd("C:/Users/marwick/Downloads/OluridaSurvey2014-master/OluridaSurvey2014-master")
##
## > daby1edit <- read.csv("data/Dabob-temp-2014.csv")
##
## > daby1edit$Date <- as.Date(daby1edit$Date, "%m/%d/%Y")
##
## > dabmeantemp <- ddply(daby1edit, .(Date), summarise,
## + mean_temp = mean(Temp, na.rm = T), min_temp = min(Temp, na.rm = T),
## + max_temp = max .... [TRUNCATED]
##
## > many1v3 <- read.csv("./data/Manchester-temp-2014.csv")
##
## > many1v3$Date <- as.Date(many1v3$Date, "%m/%d/%Y")
##
## > manmeantemp <- ddply(many1v3, .(Date), summarise,
## + mean_temp = mean(Temp, na.rm = T), min_temp = min(Temp, na.rm = T),
## + max_temp = max(T .... [TRUNCATED]
##
## > fidy1v3 <- read.csv("./data/Fidalgo-temp-2014.csv")
##
## > fidy1v3$Date <- as.Date(fidy1v3$Date, "%m/%d/%Y")
##
## > fidmeantemp <- ddply(fidy1v3, .(Date), summarise,
## + mean_temp = mean(Temp, na.rm = T), min_temp = min(Temp, na.rm = T),
## + max_temp = max(T .... [TRUNCATED]
##
## > oysy1edit <- read.csv("./data/OysterBay-temp-2014.csv")
##
## > oysy1edit$Date <- as.Date(oysy1edit$Date, "%m/%d/%Y")
##
## > oysmeantemp <- ddply(oysy1edit, .(Date), summarise,
## + mean_temp = mean(Temp, na.rm = T), min_temp = min(Temp, na.rm = T),
## + max_temp = max .... [TRUNCATED]
##
## > ggplot() + geom_line(data = dabmeantemp, aes(x = Date,
## + y = mean_temp, group = 1), col = "forestgreen", size = 1,
## + guide = T) + geom_lin .... [TRUNCATED]
##
## > ggplot() + geom_line(data = dabmeantemp, aes(x = Date,
## + y = mean_temp, group = 1, colour = "1"), size = 1) + geom_line(data = manmeantemp,
## + .... [TRUNCATED]
##
## > ggplot() + geom_line(data = dabmeantemp, aes(x = Date,
## + y = min_temp, group = 1, colour = "1"), size = 1) + geom_line(data = manmeantemp,
## + .... [TRUNCATED]
##
## > ggplot() + geom_line(data = dabmeantemp, aes(x = Date,
## + y = max_temp, group = 1, colour = "1"), size = 1) + geom_line(data = manmeantemp,
## + .... [TRUNCATED]
source("Kaplan-meier-stats-plot-all.R", print.eval = TRUE, echo = TRUE)
##
## > require(survival)
## Loading required package: survival
## Loading required package: splines
##
## > require(RVAideMemoire)
## Loading required package: RVAideMemoire
## Warning: package 'RVAideMemoire' was built under R version 3.1.2
## *** Package RVAideMemoire v 0.9-41 ***
##
## > require(multcomp)
## Loading required package: multcomp
## Warning: package 'multcomp' was built under R version 3.1.2
## Loading required package: mvtnorm
## Warning: package 'mvtnorm' was built under R version 3.1.2
## Loading required package: TH.data
## Warning: package 'TH.data' was built under R version 3.1.2
##
## > setwd("C:/Users/marwick/Downloads/OluridaSurvey2014-master/OluridaSurvey2014-master")
##
## > kmdab = read.csv("./data/KMdataDabob.csv")
##
## > names(kmdab)
## [1] "Animal" "Population" "Death" "Status"
##
## > with(kmdab, tapply(Death[Status == 1], Population[Status ==
## + 1], mean))
## H N S
## 4.384615 4.521614 4.714789
##
## > with(kmdab, tapply(Death[Status == 1], Population[Status ==
## + 1], var))
## H N S
## 0.4523810 0.9785777 1.6038795
##
## > fit1 = with(kmdab, survfit(Surv(Death, Status) ~ Population))
##
## > summary(fit1)
## Call: survfit(formula = Surv(Death, Status) ~ Population)
##
## Population=H
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 113 0.765 0.0194 0.728 0.803
## 5 307 53 0.633 0.0230 0.589 0.679
## 8 214 3 0.624 0.0232 0.580 0.671
##
## Population=N
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 229 0.523 0.0228 0.480 0.570
## 5 208 97 0.279 0.0218 0.239 0.325
## 8 88 21 0.212 0.0209 0.175 0.258
##
## Population=S
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 180 0.625 0.0221 0.583 0.670
## 5 249 71 0.447 0.0239 0.402 0.496
## 8 144 33 0.344 0.0241 0.300 0.395
##
##
## > plot(fit1, xlim = c(0, 11), col = c("#3366CC", "#CC66CC",
## + "#FF9900"), xlab = "Survival Time from Outplant in Months",
## + ylab = "Proporti ..." ... [TRUNCATED]
##
## > legend("bottomleft", title = "Population", c("Dabob",
## + "Fidalgo", "Oyster Bay"), fill = c("#3366CC", "#CC66CC",
## + "#FF9900"))
##
## > kmman = read.csv("./data/KMdataMan.csv")
##
## > names(kmman)
## [1] "Animal" "Population" "Death" "Status"
##
## > with(kmman, tapply(Death[Status == 1], Population[Status ==
## + 1], mean))
## H N S
## 10.540000 9.367816 9.197368
##
## > with(kmman, tapply(Death[Status == 1], Population[Status ==
## + 1], var))
## H N S
## 1.518776 6.467789 6.320526
##
## > fit2 = with(kmman, survfit(Surv(Death, Status) ~ Population))
##
## > summary(fit2)
## Call: survfit(formula = Surv(Death, Status) ~ Population)
##
## Population=H
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 1 0.998 0.00208 0.994 1.000
## 6 446 1 0.996 0.00305 0.990 1.000
## 10 445 11 0.971 0.00791 0.956 0.987
## 11 434 37 0.888 0.01489 0.860 0.918
##
## Population=N
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 13 0.973 0.00741 0.959 0.988
## 6 435 5 0.962 0.00885 0.945 0.979
## 10 430 26 0.904 0.01383 0.877 0.931
## 11 404 43 0.807 0.01857 0.772 0.845
##
## Population=S
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 12 0.975 0.00713 0.961 0.989
## 6 436 4 0.966 0.00835 0.950 0.983
## 10 432 33 0.892 0.01456 0.864 0.921
## 11 399 27 0.832 0.01761 0.798 0.867
##
##
## > plot(fit2, col = c("#3366CC", "#CC66CC", "#FF9900"),
## + xlab = "Survival Time from Outplant in Months", ylab = "Proportion Surviving",
## + lw .... [TRUNCATED]
##
## > legend("bottomleft", title = "Population", c("Dabob",
## + "Fidalgo", "Oyster Bay"), fill = c("#3366CC", "#CC66CC",
## + "#FF9900"))
##
## > kmfid = read.csv("./data/KMdataFid.csv")
##
## > with(kmfid, tapply(Death[Status == 1], Population[Status ==
## + 1], mean))
## H N S
## 5.921053 5.754098 6.897436
##
## > with(kmfid, tapply(Death[Status == 1], Population[Status ==
## + 1], var))
## H N S
## 2.553684 2.188525 3.989344
##
## > fit3 = with(kmfid, survfit(Surv(Death, Status) ~ Population))
##
## > summary(fit3)
## Call: survfit(formula = Surv(Death, Status) ~ Population)
##
## Population=H
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 21 0.956 0.00934 0.938 0.975
## 6 426 43 0.860 0.01629 0.828 0.892
## 9 383 12 0.833 0.01753 0.799 0.868
##
## Population=N
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 18 0.963 0.00867 0.946 0.980
## 6 430 36 0.882 0.01511 0.853 0.912
## 9 394 7 0.866 0.01596 0.836 0.898
##
## Population=S
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 16 0.967 0.00819 0.951 0.983
## 6 431 28 0.904 0.01380 0.877 0.931
## 9 403 34 0.828 0.01778 0.793 0.863
##
##
## > plot(fit3, col = c("#3366CC", "#CC66CC", "#FF9900"),
## + xlab = "Survival Time from Outplant in Months", ylab = "Proportion Surviving",
## + lw .... [TRUNCATED]
##
## > legend("bottomleft", title = "Population", c("Dabob",
## + "Fidalgo", "Oyster Bay"), fill = c("#3366CC", "#CC66CC",
## + "#FF9900"))
##
## > kmoys = read.csv("./data/KMdataOys.csv")
##
## > with(kmoys, tapply(Death[Status == 1], Population[Status ==
## + 1], mean))
## H N S
## 7.550000 8.069124 8.395760
##
## > with(kmoys, tapply(Death[Status == 1], Population[Status ==
## + 1], var))
## H N S
## 7.774460 5.805385 5.814450
##
## > fit4 = with(kmoys, survfit(Surv(Death, Status) ~ Population))
##
## > summary(fit4)
## Call: survfit(formula = Surv(Death, Status) ~ Population)
##
## Population=H
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 50 0.896 0.0139 0.869 0.924
## 6 397 3 0.889 0.0144 0.861 0.918
## 9 394 52 0.772 0.0196 0.734 0.811
## 10 342 14 0.740 0.0206 0.701 0.782
## 11 328 21 0.693 0.0217 0.652 0.737
##
## Population=N
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 47 0.902 0.0136 0.876 0.929
## 6 403 16 0.866 0.0157 0.836 0.898
## 9 387 94 0.656 0.0223 0.614 0.701
## 10 293 39 0.569 0.0233 0.525 0.616
## 11 254 21 0.522 0.0235 0.477 0.570
##
## Population=S
## time n.risk n.event survival std.err lower 95% CI upper 95% CI
## 4 480 52 0.892 0.0142 0.864 0.920
## 6 395 25 0.835 0.0172 0.802 0.870
## 9 370 69 0.679 0.0220 0.638 0.724
## 10 301 110 0.431 0.0234 0.388 0.480
## 11 191 27 0.370 0.0229 0.328 0.418
##
##
## > plot(fit4, col = c("#3366CC", "#CC66CC", "#FF9900"),
## + xlab = "Survival Time from Outplant in Months", ylab = "Proportion Surviving",
## + lw .... [TRUNCATED]
##
## > legend("bottomleft", title = "Population", c("Dabob",
## + "Fidalgo", "Oyster Bay"), fill = c("#3366CC", "#CC66CC",
## + "#FF9900"))
##
## > mansurv <- survdiff(Surv(Death, Status) ~ Population,
## + data = kmman, rho = 1)
##
## > print(mansurv)
## Call:
## survdiff(formula = Surv(Death, Status) ~ Population, data = kmman,
## rho = 1)
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## Population=H 480 46.8 69.8 7.584 12.95
## Population=N 480 82.9 66.6 4.001 6.66
## Population=S 480 73.0 66.3 0.676 1.12
##
## Chisq= 13.7 on 2 degrees of freedom, p= 0.00105
##
## > dabsurv <- survdiff(Surv(Death, Status) ~ Population,
## + data = kmdab)
##
## > print(dabsurv)
## Call:
## survdiff(formula = Surv(Death, Status) ~ Population, data = kmdab)
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## Population=H 480 169 290 50.59 118.14
## Population=N 480 347 245 42.05 91.28
## Population=S 480 284 264 1.45 3.21
##
## Chisq= 141 on 2 degrees of freedom, p= 0
##
## > fidsurv <- survdiff(Surv(Death, Status) ~ Population,
## + data = kmfid)
##
## > print(fidsurv)
## Call:
## survdiff(formula = Surv(Death, Status) ~ Population, data = kmfid)
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## Population=H 480 76 71.0 0.359 0.571
## Population=N 480 61 71.8 1.619 2.590
## Population=S 480 78 72.3 0.455 0.730
##
## Chisq= 2.6 on 2 degrees of freedom, p= 0.274
##
## > oyssurv <- survdiff(Surv(Death, Status) ~ Population,
## + data = kmoys)
##
## > print(oyssurv)
## Call:
## survdiff(formula = Surv(Death, Status) ~ Population, data = kmoys)
##
## N Observed Expected (O-E)^2/E (O-E)^2/V
## Population=H 480 140 227 33.168 60.10
## Population=N 480 217 210 0.201 0.35
## Population=S 480 283 203 31.724 54.35
##
## Chisq= 76.3 on 2 degrees of freedom, p= 0
source("sizedist-stats-plot.R", print.eval = TRUE, echo = TRUE)
##
## > require(ggplot2)
##
## > require(plyr)
##
## > require(splitstackshape)
## Loading required package: splitstackshape
## Warning: package 'splitstackshape' was built under R version 3.1.2
## Loading required package: data.table
##
## > require(nparcomp)
## Loading required package: nparcomp
## Warning: package 'nparcomp' was built under R version 3.1.2
##
## > require(PMCMR)
## Loading required package: PMCMR
## Warning: package 'PMCMR' was built under R version 3.1.2
##
## > setwd("C:/Users/marwick/Downloads/OluridaSurvey2014-master/OluridaSurvey2014-master")
##
## > y1size = read.csv("./data/Size-outplant-end-all-2013-14.csv")
##
## > y1size$Date <- as.Date(y1size$Date, "%m/%d/%Y")
##
## > y1meansize <- ddply(y1size, .(Date, Site, Pop), summarise,
## + mean_size = mean(Length.mm, na.rm = T))
##
## > outmany1 <- ddply(y1size, .(Length.mm, Pop, Tray,
## + Sample, Area), subset, Date == "2013-08-16" & Site == "Manchester")
##
## > outfidy1 <- ddply(y1size, .(Length.mm, Pop, Tray,
## + Sample, Area), subset, Date == "2013-08-16" & Site == "Fidalgo")
##
## > outoysy1 <- ddply(y1size, .(Length.mm, Pop, Tray,
## + Sample, Area), subset, Date == "2013-08-16" & Site == "Oyster Bay")
##
## > endmany1 <- ddply(y1size, .(Length.mm, Pop, Tray,
## + Sample, Area), subset, Date == "2014-10-24" & Site == "Manchester")
##
## > endfidy1 <- ddply(y1size, .(Length.mm, Pop, Tray,
## + Sample, Area), subset, Date == "2014-10-17" & Site == "Fidalgo")
##
## > endoysy1 <- ddply(y1size, .(Length.mm, Pop, Tray,
## + Sample, Area), subset, Date == "2014-09-19" & Site == "Oyster Bay")
##
## > ggplot() + geom_boxplot(data = outmany1, aes(x = Pop,
## + y = Length.mm, fill = Pop)) + scale_colour_manual(values = c("blue",
## + "purple", " ..." ... [TRUNCATED]
##
## > ggplot() + geom_boxplot(data = endmany1, aes(x = Pop,
## + y = Length.mm, fill = Pop)) + scale_colour_manual(values = c("blue",
## + "purple", " ..." ... [TRUNCATED]
##
## > ggplot() + geom_boxplot(data = outfidy1, aes(x = Pop,
## + y = Length.mm, fill = Pop)) + scale_colour_manual(values = c("blue",
## + "purple", " ..." ... [TRUNCATED]
##
## > ggplot() + geom_boxplot(data = endfidy1, aes(x = Pop,
## + y = Length.mm, fill = Pop)) + scale_colour_manual(values = c("blue",
## + "purple", " ..." ... [TRUNCATED]
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
##
## > ggplot() + geom_boxplot(data = outoysy1, aes(x = Pop,
## + y = Length.mm, fill = Pop)) + scale_colour_manual(values = c("blue",
## + "purple", " ..." ... [TRUNCATED]
##
## > ggplot() + geom_boxplot(data = endoysy1, aes(x = Pop,
## + y = Length.mm, fill = Pop)) + scale_colour_manual(values = c("blue",
## + "purple", " ..." ... [TRUNCATED]
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
##
## > normality <- ddply(y1size, .(Date, Site, Pop), summarize,
## + n = length(Length.mm), sw = shapiro.test(as.numeric(Length.mm))[2])
##
## > y1size$Pop2 <- y1size$Pop
##
## > y1size$Pop2 <- revalue(y1size$Pop2, c(`1H` = "H",
## + `2H` = "H", `4H` = "H", `1N` = "N", `2N` = "N", `4N` = "N",
## + `1S` = "S", `2S` = "S", .... [TRUNCATED]
##
## > endy1 <- ddply(y1size, .(Length.mm, Site, Pop, Tray,
## + Sample, Area, Pop2), subset, Date >= "2014-09-19")
##
## > normality <- ddply(endy1, .(Date, Site, Pop), summarize,
## + n = length(Length.mm), sw = shapiro.test(as.numeric(Length.mm))[2])
##
## > sizekw <- kruskal.test(endy1$Length.mm ~ endy1$Site,
## + endy1)
##
## > print(sizekw)
##
## Kruskal-Wallis rank sum test
##
## data: endy1$Length.mm by endy1$Site
## Kruskal-Wallis chi-squared = 383.4411, df = 2, p-value < 2.2e-16
##
##
## > sizekwpop <- kruskal.test(endy1$Length.mm ~ endy1$Pop2,
## + endy1)
##
## > print(sizekwpop)
##
## Kruskal-Wallis rank sum test
##
## data: endy1$Length.mm by endy1$Pop2
## Kruskal-Wallis chi-squared = 196.062, df = 2, p-value < 2.2e-16
##
##
## > sizenemenyi1 <- posthoc.kruskal.nemenyi.test(x = endy1$Length.mm,
## + g = endy1$Site, method = "Tukey")
## Warning in posthoc.kruskal.nemenyi.test(x = endy1$Length.mm, g =
## endy1$Site, : Ties are present, p-values are not corrected.
##
## > sizenemenyi1
##
## Pairwise comparisons using Tukey and Kramer (Nemenyi) test
## with Tukey-Dist approximation for independent samples
##
## data: endy1$Length.mm and endy1$Site
##
## Fidalgo Manchester
## Manchester < 2e-16 -
## Oyster Bay 1.8e-08 < 2e-16
##
## P value adjustment method: none
##
## > sizenemenyi2 <- posthoc.kruskal.nemenyi.test(x = endy1$Length.mm,
## + g = endy1$Pop2, method = "Tukey")
## Warning in posthoc.kruskal.nemenyi.test(x = endy1$Length.mm, g =
## endy1$Pop2, : Ties are present, p-values are not corrected.
##
## > sizenemenyi2
##
## Pairwise comparisons using Tukey and Kramer (Nemenyi) test
## with Tukey-Dist approximation for independent samples
##
## data: endy1$Length.mm and endy1$Pop2
##
## H N
## N < 2e-16 -
## S 3.1e-14 2.7e-05
##
## P value adjustment method: none
##
## > sizenemenyi3 <- posthoc.kruskal.nemenyi.test(x = endy1$Length.mm,
## + g = endy1$Site:endy1$Pop2, method = "Tukey")
## Warning in posthoc.kruskal.nemenyi.test(x = endy1$Length.mm, g =
## endy1$Site:endy1$Pop2, : Ties are present, p-values are not corrected.
##
## > sizenemenyi3
##
## Pairwise comparisons using Tukey and Kramer (Nemenyi) test
## with Tukey-Dist approximation for independent samples
##
## data: endy1$Length.mm and endy1$Site:endy1$Pop2
##
## Fidalgo:H Fidalgo:N Fidalgo:S Manchester:H Manchester:N
## Fidalgo:N < 2e-16 - - - -
## Fidalgo:S 8.9e-14 0.99949 - - -
## Manchester:H 1.4e-07 < 2e-16 < 2e-16 - -
## Manchester:N 1.00000 8.2e-14 1.0e-13 5.0e-06 -
## Manchester:S 0.97486 < 2e-16 8.7e-14 0.00028 0.98814
## Oyster Bay:H 2.4e-10 0.27292 0.62532 < 2e-16 1.6e-08
## Oyster Bay:N < 2e-16 5.5e-11 4.0e-12 < 2e-16 < 2e-16
## Oyster Bay:S 1.4e-09 0.68068 0.92391 7.9e-14 3.9e-08
## Manchester:S Oyster Bay:H Oyster Bay:N
## Fidalgo:N - - -
## Fidalgo:S - - -
## Manchester:H - - -
## Manchester:N - - -
## Manchester:S - - -
## Oyster Bay:H 6.2e-12 - -
## Oyster Bay:N < 2e-16 1.2e-13 -
## Oyster Bay:S 3.8e-11 1.00000 6.0e-12
##
## P value adjustment method: none
source("percbrood-temp-plot-OysterBay.R", print.eval = TRUE, echo = TRUE)
##
## > require(plyr)
##
## > require(ggplot2)
##
## > require(scales)
## Loading required package: scales
##
## > require(grid)
## Loading required package: grid
##
## > require(gtable)
## Loading required package: gtable
## Warning: package 'gtable' was built under R version 3.1.2
##
## > setwd("C:/Users/marwick/Downloads/OluridaSurvey2014-master/OluridaSurvey2014-master")
##
## > brood <- read.csv("./data/Brood-numbers-all-2014.csv")
##
## > brood$Date <- as.Date(brood$Date, "%m/%d/%Y")
##
## > oysbay <- subset(brood, Site == "Oyster Bay")
##
## > grid.newpage()
##
## > p1 <- ggplot(data = oysbay, aes(x = Date, weight = Percent,
## + colour = Pop, fill = Pop)) + geom_bar(binwidth = 3, position = position_dodge()) .... [TRUNCATED]
##
## > oystemp <- read.csv("./data/OysterBay-temp-2014.csv")
##
## > oystemp$Date <- as.Date(oystemp$Date, "%m/%d/%Y")
##
## > oysmintemp <- ddply(oystemp, .(Date), summarise, min_temp = min(Temp,
## + na.rm = T))
##
## > oysmintemprep <- subset(oysmintemp, Date >= "2014-05-01" &
## + Date <= "2014-08-07")
##
## > p2 <- ggplot() + geom_line(data = oysmintemprep, aes(x = Date,
## + y = min_temp), color = "red") + ylim(c(8, 18)) + theme_bw() %+replace%
## + .... [TRUNCATED]
##
## > g1 <- ggplot_gtable(ggplot_build(p1))
##
## > g2 <- ggplot_gtable(ggplot_build(p2))
##
## > pp <- c(subset(g1$layout, name == "panel", se = t:r))
##
## > g <- gtable_add_grob(g1, g2$grobs[[which(g2$layout$name ==
## + "panel")]], pp$t, pp$l, pp$b, pp$l)
##
## > ia <- which(g2$layout$name == "axis-l")
##
## > ga <- g2$grobs[[ia]]
##
## > ax <- ga$children[[2]]
##
## > ax$widths <- rev(ax$widths)
##
## > ax$grobs <- rev(ax$grobs)
##
## > ax$grobs[[1]]$x <- ax$grobs[[1]]$x - unit(1, "npc") +
## + unit(0.15, "cm")
##
## > g <- gtable_add_cols(g, g2$widths[g2$layout[ia, ]$l],
## + length(g$widths) - 1)
##
## > g <- gtable_add_grob(g, ax, pp$t, length(g$widths) -
## + 1, pp$b)
##
## > grid.draw(g)
source("percbrood-temp-plot-Fidalgo.R", print.eval = TRUE,echo = TRUE)
##
## > require(plyr)
##
## > require(ggplot2)
##
## > require(scales)
##
## > require(grid)
##
## > require(gtable)
##
## > setwd("C:/Users/marwick/Downloads/OluridaSurvey2014-master/OluridaSurvey2014-master")
##
## > brood <- read.csv("./data/Brood-numbers-all-2014.csv")
##
## > brood$Date <- as.Date(brood$Date, "%m/%d/%Y")
##
## > fidrep <- subset(brood, Site == "Fidalgo")
##
## > grid.newpage()
##
## > p1 <- ggplot(data = fidrep, aes(x = Date, weight = Percent,
## + colour = Pop, fill = Pop)) + geom_bar(binwidth = 3, position = position_dodge()) .... [TRUNCATED]
##
## > fidtemp <- read.csv("./data/Fidalgo-temp-2014.csv")
##
## > fidtemp$Date <- as.Date(fidtemp$Date, "%m/%d/%Y")
##
## > fidmintemp <- ddply(fidtemp, .(Date), summarise, min_temp = min(Temp,
## + na.rm = T))
##
## > fidmintemprep <- subset(fidmintemp, Date >= "2014-05-02" &
## + Date <= "2014-08-08")
##
## > p2 <- ggplot() + geom_line(data = fidmintemprep, aes(x = Date,
## + y = min_temp), color = "red") + labs(y = "Daily Minimum Water Temperature (C)" .... [TRUNCATED]
##
## > g1 <- ggplot_gtable(ggplot_build(p1))
##
## > g2 <- ggplot_gtable(ggplot_build(p2))
##
## > pp <- c(subset(g1$layout, name == "panel", se = t:r))
##
## > g <- gtable_add_grob(g1, g2$grobs[[which(g2$layout$name ==
## + "panel")]], pp$t, pp$l, pp$b, pp$l)
##
## > ia <- which(g2$layout$name == "axis-l")
##
## > ga <- g2$grobs[[ia]]
##
## > ax <- ga$children[[2]]
##
## > ax$widths <- rev(ax$widths)
##
## > ax$grobs <- rev(ax$grobs)
##
## > ax$grobs[[1]]$x <- ax$grobs[[1]]$x - unit(1, "npc") +
## + unit(0.15, "cm")
##
## > g <- gtable_add_cols(g, g2$widths[g2$layout[ia, ]$l],
## + length(g$widths) - 1)
##
## > g <- gtable_add_grob(g, ax, pp$t, length(g$widths) -
## + 1, pp$b)
##
## > grid.draw(g)
source("percbrood-temp-plot-Manchester.R", print.eval = TRUE, echo = TRUE)
##
## > require(plyr)
##
## > require(ggplot2)
##
## > require(scales)
##
## > require(grid)
##
## > require(gtable)
##
## > setwd("C:/Users/marwick/Downloads/OluridaSurvey2014-master/OluridaSurvey2014-master")
##
## > brood <- read.csv("./data/Brood-numbers-all-2014.csv")
##
## > brood$Date <- as.Date(brood$Date, "%m/%d/%Y")
##
## > manrep <- subset(brood, Site == "Manchester")
##
## > grid.newpage()
##
## > p1 <- ggplot(data = manrep, aes(x = Date, weight = Percent,
## + colour = Pop, fill = Pop)) + geom_bar(binwidth = 3, position = position_dodge()) .... [TRUNCATED]
##
## > manch <- read.csv("./data/Manchester-temp-2014.csv")
##
## > manch$Date <- as.Date(manch$Date, "%m/%d/%Y")
##
## > manmintemp <- ddply(manch, .(Date), summarise, min_temp = min(Temp,
## + na.rm = T))
##
## > manmintemprep <- subset(manmintemp, Date >= "2014-04-30" &
## + Date <= "2014-08-06")
##
## > p2 <- ggplot() + geom_line(data = manmintemprep, aes(x = Date,
## + y = min_temp), color = "red") + ylim(c(8, 18)) + theme_bw() %+replace%
## + .... [TRUNCATED]
##
## > g1 <- ggplot_gtable(ggplot_build(p1))
##
## > g2 <- ggplot_gtable(ggplot_build(p2))
##
## > pp <- c(subset(g1$layout, name == "panel", se = t:r))
##
## > g <- gtable_add_grob(g1, g2$grobs[[which(g2$layout$name ==
## + "panel")]], pp$t, pp$l, pp$b, pp$l)
##
## > ia <- which(g2$layout$name == "axis-l")
##
## > ga <- g2$grobs[[ia]]
##
## > ax <- ga$children[[2]]
##
## > ax$widths <- rev(ax$widths)
##
## > ax$grobs <- rev(ax$grobs)
##
## > ax$grobs[[1]]$x <- ax$grobs[[1]]$x - unit(1, "npc") +
## + unit(0.15, "cm")
##
## > g <- gtable_add_cols(g, g2$widths[g2$layout[ia, ]$l],
## + length(g$widths) - 1)
##
## > g <- gtable_add_grob(g, ax, pp$t, length(g$widths) -
## + 1, pp$b)
##
## > grid.draw(g)
Dependencies within R:
# show package names and version numbers (not give in the paper)
sessionInfo()
## R version 3.1.1 (2014-07-10)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
##
## locale:
## [1] LC_COLLATE=English_United States.1252
## [2] LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
##
## attached base packages:
## [1] grid splines stats graphics grDevices utils datasets
## [8] methods base
##
## other attached packages:
## [1] gtable_0.1.2 scales_0.2.4 PMCMR_1.0
## [4] nparcomp_2.5 splitstackshape_1.4.2 data.table_1.9.4
## [7] multcomp_1.3-8 TH.data_1.0-4 mvtnorm_1.0-1
## [10] RVAideMemoire_0.9-41 survival_2.37-7 ggplot2_1.0.0
## [13] plyr_1.8.1
##
## loaded via a namespace (and not attached):
## [1] car_2.0-22 chron_2.3-45 colorspace_1.2-4
## [4] digest_0.6.4 evaluate_0.5.5 formatR_1.0
## [7] htmltools_0.2.6 knitr_1.8 labeling_0.3
## [10] lattice_0.20-29 MASS_7.3-33 munsell_0.4.2
## [13] nnet_7.3-8 proto_0.3-10 Rcpp_0.11.3
## [16] reshape2_1.4.0.99 rmarkdown_0.3.12 sandwich_2.3-2
## [19] stringr_0.6.2 tools_3.1.1 yaml_2.1.13
## [22] zoo_1.7-11