Learn R Programming

geomorph (version 4.0.8)

interlmkdist: Calculate linear distances between landmarks

Description

A function to calculate linear distances between a set of landmark coordinates (interlandmark distances)

Usage

interlmkdist(A, lmks)

Value

Function returns a matrix (n x m) of m linear distances for n specimens

Arguments

A

A 3D array (p x k x n) containing landmark coordinates for a set of specimens

lmks

A matrix or dataframe of landmark addresses for the start and end landmarks defining m linear measurements (can be either 2-x-m or m-x-2). Either the rows or the columns should have names 'start' and 'end' to define landmarks.

Author

Emma Sherratt & Michael Collyer

Details

Function takes a 3D array of landmark coordinates from a set of specimens and the addresses for the start and end landmarks defining linear measurements and then calculates the interlandmark distances. The function returns a matrix of linear distances for all specimens. If the 'lmks' matrix has row or column names defining the name of the linear measurements, the returned matrix will use these for column names (see example). If only two interlandmark distances, 'lmks' input must be m x 2.

Examples

Run this code
 
if (FALSE) {
data(plethodon)
# Make a matrix defining three interlandmark distances 
lmks <- matrix(c(8,9,6,12,4,2), ncol=2, byrow=TRUE, 
dimnames = list(c("eyeW", "headL", "mouthL"),c("start", "end")))

# where 8-9 is eye width; 6-12 is head length; 4-2 is mouth length
# or alternatively

lmks <- data.frame(eyeW = c(8,9), headL = c(6,12), mouthL = c(4,2), 
row.names = c("start", "end")) 

A <- plethodon$land
lineardists <- interlmkdist(A, lmks)
}

Run the code above in your browser using DataLab