lsr | R Documentation |
This function computes log-shape ratios and size from a matrix of morphological measurements (columns) from individual specimens (rows).
lsr(mat, transf = TRUE)
mat |
The data matrix with specimens as rows and measurements as columns. Missing values (NAs) will cause problems. |
transf |
Logical. If TRUE (default) a natural log is applied to te data matrix. |
The code was copied and modified from the Rmorph package from M. Baylac. By default, the function applies a natural log transform to the data, so if your data matrix is already log-transformed, please set transf=F.
size. A vector containing sizes (geometric mean of measurements).
lsr. A matrix containing log-shape ratio values.
nobj. The number of specimens (objects).
nvar. The number of measurements (variables).
data("equus", package="MorphoInd")
m <- matrix(NA, 22, 15) #Make empty matrix
for (i in 1:15) {m[,i] <- rnorm(n=22,mean=equus[[1]]["Mean",i], sd=equus[[1]]["St-Dev",i])} #Generate normally distributed morphological data based on summary statistics of the first sample in the equus dataset.
LSR <-lsr(m) #Compute size and LSR values (warning: NAs can be produced if the generated data has negative values, which is not possible for real data).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.