lsr: Log-Shape Ratios (from Rmorph, M. Baylac)

View source: R/LSR.R

lsrR Documentation

Log-Shape Ratios (from Rmorph, M. Baylac)

Description

This function computes log-shape ratios and size from a matrix of morphological measurements (columns) from individual specimens (rows).

Usage

lsr(mat, transf = TRUE)

Arguments

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.

Details

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.

Value

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).

Examples

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).

sginot/MorphoInd documentation built on Jan. 27, 2024, 1:32 a.m.