matrix2list: Partitioning a matrix by row into objects of a list

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/matrix2list.R

Description

This function partitions each row of a matrix into objects of a list.

Usage

1

Arguments

x

a matrix

Details

This function converts the landmark coordinate data into a format suitable as input for anglePolygon.

Value

a list of objects; the number of objects is equal to the number of rows of x; each object is a vector of length equal to the number of columns of x

Author(s)

Tsung Fei Khang tfkhang@um.edu.my

References

Khang TF, Soo OYM, Tan WB, Lim LHS. (2016). Monogenean anchor morphometry: systematic value, phylogenetic signal, and evolution. PeerJ 4:e1668.

See Also

anglePolygon

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(ligophorus_tpsdata)

#Check right ventral anchor polygon of the first specimen
anglePolygon(matrix2list(ligophorus_tpsdata$bantingensis[[1]][1:11,]), degree=TRUE)

#Now check the rest
anglePolygon(matrix2list(ligophorus_tpsdata$bantingensis[[1]][12:22,]), degree=TRUE)
anglePolygon(matrix2list(ligophorus_tpsdata$bantingensis[[1]][23:33,]), degree=TRUE)
anglePolygon(matrix2list(ligophorus_tpsdata$bantingensis[[1]][34:44,]), degree=TRUE)

#A more efficient way of doing things
result <- mapply(function(k) {
anglePolygon(matrix2list(ligophorus_tpsdata$bantingensis[[1]][(11*(k-1)+1):(11*k),]),
degree=TRUE)}, k=1:4)

result_angle <- mapply(function(k) list(result[[2*k-1]]), k=1:4)
result_orientation <- mapply(function(k) list(result[[2*k]]), k=1:4)
names(result_angle) <- names(result_orientation) <- c("VR","VL","DR","DL")

monogeneaGM documentation built on May 29, 2017, 9:18 p.m.