landmarkMatrixToList: Converts a landmark matrix to a landmark list

View source: R/landmarkMatrixToList.R

landmarkMatrixToListR Documentation

Converts a landmark matrix to a landmark list

Description

Converts a landmark matrix to a landmark list.

Usage

landmarkMatrixToList(lm.matrix, semilandmark.pattern='[0-9]+$', k=ncol(lm.matrix))

Arguments

lm.matrix

a landmark matrix. See readLandmarksToMatrix.

semilandmark.pattern

a regular expression pattern passed to sub() for identifying and grouping curve points. The default is landmark names ending in one or more numbers. To disable grouping, set to code”.

k

the number of dimensions of the landmark data.

Value

a landmark list.

Author(s)

Aaron Olsen

See Also

landmarkListToMatrix, readLandmarksToList, readLandmarksToMatrix

Examples


## GET FILE DIRECTORY FOR PACKAGE FILES
fdir <- paste0(path.package("StereoMorph"), "/extdata/")

## SET FILES TO LOAD - TWO DIFFERENT 3D POINT SETS
file <- paste0(fdir, "lm_2d_a1_v", 1:2, ".txt")

## READ LANDMARKS INTO A LIST
lm.matrix <- readLandmarksToMatrix(file=file, row.names=1)

## CONVERT LANDMARK LIST TO LANDMARK MATRIX
lm.list <- landmarkMatrixToList(lm.matrix, k=2)

## CAN BE CONVERTED BACK INTO MATRIX
## RECOVERING THE SAME MATRIX AS THE ORIGINAL
lm.matrix <- landmarkListToMatrix(lm.list)

aaronolsen/StereoMorph documentation built on June 2, 2022, 4:09 a.m.