shapeR | R Documentation |
Collection and analysis of otolith shape data
a shapeR class
shapeR(project.path, info.file, ...)
project.path |
The base project path where the images are stored |
info.file |
The information file which store the information on the fish and otoliths. This is the base for the master.list |
... |
Additional parameters to be passed to 'read.csv' for reading the info.file |
a shapeR
object
project.path
Path to the project where the images are stored
info.file
Info file containing fish and otolith information
master.list.org
The contents of the info.file
master.list
The contents of the info.file
with added shape parameters and descriptors
outline.list.org
A list of all the original otolith outlines
outline.list
A list of all the otolith outlines. It returns a list of smoothed if contour smoothing (usingsmoothout
) has been conducted.
filter
A logical vector selecting the otoliths used for analysis
wavelet.coef.raw
The wavelet coefficients for all the otolith outlines
wavelet.coef
The wavelet coefficients after aligning with the info.file
. The data is generated when enrich.master.list is run
wavelet.coef.std
The standardized wavelet coefficients. The data is generated when stdCoefs is run
wavelet.coef.std.removed
The index of the removed wavelet coefficients after standardization. The data is generated when stdCoefs is run
fourier.coef.raw
The Fourier coefficients for all the otolith outlines
fourier.coef
The Fourier coefficients for after aligning with the info file. The data is generated when enrich.master.list is run
fourier.coef.std
The standardized Fourier coefficients. The data is generated when stdCoefs is run
fourier.coef.std.removed
The index of the removed Fourier coefficents after standardization. The data is generated when stdCoefs is run
shape.coef.raw
The uncalibrated shape measurements for all the otoliths. The shape parameters are: otolith.area, otolith.length, otolith.width, otolith.perimeter
shape.coef
The shape measurements for after aligning with the info file. The shape parameters have been calibrated using the calibration parameter as registered in the datafile as the column 'cal'.
shape.std
The standardized shape measurements. The data is generated when stdCoefs is run
shape.std.removed
The index of the removed shape measurements after standardization. The data is generated when stdCoefs is run
Lisa Anne Libungan & Snaebjorn Palsson
Libungan LA and Palsson S (2015) ShapeR: An R Package to Study Otolith Shape Variation among Fish Populations. PLoS ONE 10(3): e0121102. https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0121102
https://github.com/lisalibungan/shapeR
plotWavelet
plotFourier
plotWaveletShape
plotFourierShape
capscale
cluster.plot
setFilter
lda
detect.outline
generateShapeCoefficients
enrich.master.list
## Not run: # This example has two sections: (1) Demonstration of how a shapeR object # is analyzed and (2) How to create a shapeR object from an archive of # image files. #----------------------------------------- # Section 1: Analyzing a shapeR object data(shape) #Standardize coefficients shape = stdCoefs(shape,"pop","length_cm") #Visualize Wavelet and Fourier coefficients plotWavelet(shape,level=5,class.name= "pop",useStdcoef=TRUE) plotFourier(shape,class.name= "pop",useStdcoef=TRUE) #Examine the mean shapes plotWaveletShape(shape, "pop",show.angle = TRUE,lwd=2,lty=1) plotFourierShape(shape, "pop",show.angle = TRUE,lwd=2,lty=1) #Canonical analysis library(vegan) cap.res = capscale(getStdWavelet(shape) ~ getMasterlist(shape)$pop) anova(cap.res) #Visualize the canonical scores eig=eigenvals(cap.res,constrained=TRUE) eig.ratio = eig/sum(eig) cluster.plot(scores(cap.res)$sites[,1:2],getMasterlist(shape)$pop ,plotCI=TRUE ,xlab=paste("CAP1 (",round(eig.ratio[1]*100,1),"%)",sep="") ,ylab=paste("CAP2 (",round(eig.ratio[2]*100,1),"%)",sep="") ,main="Canonical clustering" ) #Only analyze Icelandic and Norwegian samples shape = setFilter(shape, getMasterlist(shape, useFilter = FALSE)$pop %in% c("NO","IC")) #Classifier on standardized wavelet lda.res.w = lda(getStdWavelet(shape),getMasterlist(shape)$pop,CV=TRUE) ct.w = table(getMasterlist(shape)$pop,lda.res.w$class) diag(prop.table(ct.w, 1)) # Total percent correct sum(diag(prop.table(ct.w))) cap.res = capscale(getStdWavelet(shape) ~ getMasterlist(shape)$pop) anova(cap.res) #Classifier on canoncial values lda.res.w = lda(scores(cap.res)$sites,getMasterlist(shape)$pop,CV=TRUE) ct.w = table(getMasterlist(shape)$pop,lda.res.w$class) diag(prop.table(ct.w, 1)) # Total percent correct sum(diag(prop.table(ct.w))) #----------------------------------------- # Section 2: Creating a shapeR object from image files # The following example requires the user to download an archive of JPEG # files from https://github.com/lisalibungan/shapeR/ # place the ShapeAnalysis directory inside the working directory. shape = shapeR("~/ShapeAnalysis/","FISH.csv") shape = detect.outline(shape,write.outline.w.org = TRUE) shape = generateShapeCoefficients(shape) shape = enrich.master.list(shape) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.