readPts: Read and combine multiple Landmark Editor files into a single...

View source: R/readPts.R

readPtsR Documentation

Read and combine multiple Landmark Editor files into a single data block

Description

Reads, collates and transforms landmark configurations from multiple specimens. readPts expects a directory containing two or more files with .pts extensions (i.e. landmark configurations exported from the Landmark Editor, Wiley et al. 2005).

Usage

readPts(dirpath, landmarkRM = c(), gpa = TRUE)

Arguments

dirpath

the directory path where two or more landmark configurations with .pts extensions will be found.

landmarkRM

a vector of landmarks to be excluded from the data block.

gpa

a logical value indicating whether generalized Procrustes analyses should be performed. Default is TRUE.

Details

readPts reads landmark configurations from .pts files into the R environment, organises the configurations into a single array, and performs generalized Procrustes analysis on the array if required. Several objects are calculated for downstream analyses including centroid sizes for each landmark configuration. readPts is a wrapper function for the read.pts and cSize functions from the Morpho package (Schlager 2017), and the gpagen, two.d.array and arrayspecs functions from the geomorph package (Adams and Otárola-Castillo 2013). Landmarks are identified by their sequence within the configuration, which is an important consideration when excluding landmarks from the data block. For example, landmarkRM = c(1,3) would remove the first and third landmarks from all configurations once they were read into the R environment, and thus the data block would not include landmark 1 and landmark 3. The landmarkRM term might be used for analyses that want to test the sensitivity of dataset covariation on one or more landmarks.

Value

a 'block' class object, used for downstream analyses. The list contains the elements:

raw

collation of landmark configurations without Procrustes transformation

gpa.3D

landmark configurations after Procrustes transformation organised into a 3D array

gpa.2D

landmark configurations after Procrustes transformation organised into a 2D matrix

centroid

centroid sizes of landmark configurations without Procrustes transformation

p

number of landmarks that each configuration within the data block has

k

number of dimensions that each landmark within the data block has

n

number of landmark configurations included in the data block

curves

matrix for correctly calculating position of curve semilandmarks (see geomorph::gpagen for more detail)

surfaces

vector passed for defining positions of semilandmarks on surfaces (see geomorph::gpagen for more detail)

References

Adams DC, Otárola-Castillo E. 2013. geomorph: an R package for the collection and analysis of geometric morphometric shape data. Methods in Ecology and Evolution 4:393–399 https://doi.org/10.1111/2041-210X.12035

Schlager S. 2017. Morpho and Rvcg–shape analysis in R. In Zheng G, Li S, Székely (eds.) Statistical shape and deformation analysis. Academic Press, London. Pp. 217–256.

Wiley DF, Amenta N, Alcantara DA, Ghosh D, Kil YJ, Delson E, Harcourt-Smith W, Rohlf FJ, St. John K, Hamann B. 2005. Evolutionary morphing. Proceedings of the IEEE Visualization 2005 (VIS’05), 431–438.

Examples

## Not run: 
# Example 1
# For this example to work a directory (/...) containing .pts files must first be prepared.
dirpath <- "/..."
block1 <- readPts(dirpath)
block1@p
block1@k
block1@n

# Example 2
# Exclude the first and third landmarks from the data block
block2 <- readPts(dirpath, landmarkRM = c(1, 3))
block2@p
block2@k
block2@n

## End(Not run)


aharmer/morphoBlocks documentation built on Nov. 21, 2022, 5:45 p.m.