--- title: "Bertalanffy" author: "Steu" date: "11/9/2018" output: pdf_document --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` R scrip for Walford plot (Fig. 4 of PEERJ manuscript) ```{r cars} library(ggplot2) data1 <- read.table("R_walford_plot_data.csv", header=TRUE, sep=",", na.strings="NA", dec=".", strip.white=TRUE) ggplot(data1, aes(x=H0, y=H1))+ geom_point(shape=1)+geom_smooth(method=lm) + ggtitle("Walford plot") + xlab ("length at time T0 (mm)") + ylab ("length at time T1 (mm)") + coord_fixed(ratio=1/2) + theme_bw() + theme(panel.border = element_blank(), axis.line = element_line(colour = "black")) regression_Walford <- lm(formula = H1 ~ H0, data = data1) summary(regression_Walford) ``` R scrip for von Bertalannfy (Fig. 1 supp of PEERJ manuscript) NB: con lunghezza infinito aggiustata #### styles and colour of the lines have been applied according to the following table: Reference color Line style "Ralph and Maxwell, 1977" "gray50" "dotted" "Stockton, 1984", "gray50" "dotdash" "Berkmann, 1990", "gray70" "dotted" "Chiantore et al., 2003 (BTN)", "gray26" "dotted" "Chiantore et al., 2003 (aquaria)", "gray26" "twodash" "Heilmayer et al., 2003", "gray70" "dotdash" "Present data - Walford plot (L∞ corrected)", "red3" "dashed" "Present data - iterative fitting (L∞ corrected)" "red3" "solid" ######################## ```{r} library(ggplot2) library(plyr) library(reshape2) data <- read.table("Adam_Bertalanffy.csv", header=TRUE, sep=";", na.strings="NA", dec=".", strip.white=TRUE) data datanew<-data[,1:9] names(datanew)<-c("Age", "Ralph and Maxwell, 1977", "Stockton, 1984", "Berkmann, 1990", "Chiantore et al., 2003 (BTN, 10m depth)", "Chiantore et al., 2003 (aquaria)", "Heilmayer et al., 2003", "Present study - Walford plot (L∞ adj.) (Mooring L, 54-59m depth)", "Present data - iterative fitting (L∞ adj.) (Mooring L, 54-59m depth)") dd_sub=datanew[,c(1,2,3,4,5,6,7,8,9)] dd=melt(dd_sub, id=c("Age")) p<-ggplot(dd) + geom_line(aes(x=Age, y=value, colour=variable, linetype=variable)) + scale_colour_manual(values=c("chartreuse3", "gray50", "black", "blue", "blue", "black", "firebrick2", "firebrick2")) + scale_linetype_manual(values = c("dashed", "dotdash", "dotted", "solid", "twodash", "dotdash", "dashed", "solid")) + theme_bw() + ylab("Shell height (mm)") + xlab("Estimated age (yrs)") + ggtitle(expression(paste("Von Bertalanffy growth functions for", italic(" Adamussium colbecki")))) + theme(panel.border = element_blank(), axis.line = element_line(), legend.position=c(.65,.2), legend.key = element_rect(colour = "white"), legend.title = element_blank()) + coord_fixed(ratio =0.2) p # to print a pdf file of Fig. 5 pdfFile <-c("Adamussium (Figure 1_supplementary)_Von Bertalanffy.pdf") pdf(pdfFile) ggplot(dd) + geom_line(aes(x=Age, y=value, colour=variable, linetype=variable)) + scale_colour_manual(values=c("chartreuse3", "gray50", "black", "blue", "blue", "black", "firebrick2", "firebrick2")) + scale_linetype_manual(values = c("dashed", "dotdash", "dotted", "solid", "twodash", "dotdash", "dashed", "solid")) + theme_bw() + ylab("Shell height (mm)") + xlab("Estimated age (yrs)") + ggtitle(expression(paste("Von Bertalanffy growth functions for", italic(" Adamussium colbecki")))) + theme(panel.border = element_blank(), axis.line = element_line(), legend.position=c(.65,.2), legend.key = element_rect(colour = "white"), legend.title = element_blank()) + coord_fixed(ratio =0.2) dev.off() ``` R scrip for von Bertalannfy (Fig. 5 of PEERJ manuscript) NB: con lunghezza infinito NON aggiustata #### styles and colour of the lines have been applied according to the following table: Reference color Line style "Ralph and Maxwell, 1977" "gray50" "dotted" "Stockton, 1984", "gray50" "dotdash" "Berkmann, 1990", "gray70" "dotted" "Chiantore et al., 2003 (BTN)", "gray26" "dotted" "Chiantore et al., 2003 (aquaria)", "gray26" "twodash" "Heilmayer et al., 2003", "gray70" "dotdash" "Present data - Walford plot (L∞ corrected)", "red3" "dashed" "Present data - iterative fitting (L∞ corrected)" "red3" "solid" ######################## ```{r} library(ggplot2) library(plyr) library(reshape2) data <- read.table("Adam_Bertalanffy_2018.csv", header=TRUE, sep=";", na.strings="NA", dec=".", strip.white=TRUE) data datanew<-data[,1:9] names(datanew)<-c("Age", "Ralph and Maxwell, 1977", "Stockton, 1984", "Berkmann, 1990", "Chiantore et al., 2003 (BTN, 10m depth)", "Chiantore et al., 2003 (aquaria)", "Heilmayer et al., 2003", "Present study - Walford plot (Mooring L, 54-59m depth)", "Present data - iterative fitting (Mooring L, 54-59m depth)") dd_sub=datanew[,c(1,2,3,4,5,6,7,8,9)] dd=melt(dd_sub, id=c("Age")) p<-ggplot(dd) + geom_line(aes(x=Age, y=value, colour=variable, linetype=variable)) + scale_colour_manual(values=c("chartreuse3", "gray50", "black", "blue", "blue", "black", "firebrick2", "firebrick2")) + scale_linetype_manual(values = c("dashed", "dotdash", "dotted", "solid", "twodash", "dotdash", "dashed", "solid")) + theme_bw() + ylab("Shell height (mm)") + xlab("Estimated age (yrs)") + ggtitle(expression(paste("Von Bertalanffy growth functions for", italic(" Adamussium colbecki")))) + theme(panel.border = element_blank(), axis.line = element_line(), legend.position=c(.65,.2), legend.key = element_rect(colour = "white"), legend.title = element_blank()) + coord_fixed(ratio =0.2) p pdfFile <-c("Adamussium_Figure 5_Von Bertalanffy.pdf") pdf(pdfFile) ggplot(dd) + geom_line(aes(x=Age, y=value, colour=variable, linetype=variable)) + scale_colour_manual(values=c("chartreuse3", "gray50", "black", "blue", "blue", "black", "firebrick2", "firebrick2")) + scale_linetype_manual(values = c("dashed", "dotdash", "dotted", "solid", "twodash", "dotdash", "dashed", "solid")) + theme_bw() + ylab("Shell height (mm)") + xlab("Estimated age (yrs)") + ggtitle(expression(paste("Von Bertalanffy growth functions for", italic(" Adamussium colbecki")))) + theme(panel.border = element_blank(), axis.line = element_line(), legend.position=c(.65,.2), legend.key = element_rect(colour = "white"), legend.title = element_blank()) + coord_fixed(ratio =0.2) dev.off() ``` ```{r} ``` R scrip for modelling size-frequency distribution (Fig. 8 of PEERJ manuscript) ```{r} library(mixdist) adaraw <- read.csv("R_Adam-sizefreq.csv", sep=";") adamix <- as.mixdata(adaraw) plot(adamix) fitada1 <- mix(adamix,mixparam(c(1,3),0.5),dist="lnorm", mixconstr(consigma="CCV"), emsteps=10) plot(fitada1) summary(fitada1) # plot(fitada1, root=T) # anova(fitada1) ```