array2matrix | R Documentation |
Convert an array with landmark points into an object of class matrix.
array2matrix(X, coords = c(2, 3))
X |
Array, |
coords |
Integer, 2 or 3, for 2D or 3D landmarks, respectively. |
The object X
, class array, has format k x q x s
, where k
is
the number of landmarks, q
the number of coordinates, and s
the number
of specimens. See C.arr.unal
for an example of the format of a 3D array
and data-raw/C.R
for the details about how to generate this object.
An object of class matrix, with s
rows, one for specimen, and n
columns, one
for each coordinate of the landmarks.
Each landmark can be given in 2D or 3D. For instance,
if the landmarks are 3D, the first 3 columns will be the
coordinates x, y, and z for the first landmark, the next 3
columns for the second landmark, and so on.
specimens | lmk1.x | lmk1.y | lmk1.z | lmk2.x | lmk2.y | lmk2.z | ... |
Sp_1 | 0.143 | -0.028 | -0.044 | 0.129 | 0.028 | -0.043 | ... |
Sp_2 | 0.128 | -0.024 | -0.028 | 0.124 | 0.027 | -0.025 | ... |
... | ... | ... | ... | ... | ... | ... | ... |
See object C
for a more detailed example of the format of the
object that is returned and data-raw/C.R
for the explanation
about how to generate this object.
Note that if the names for the s
matrices, one per specimen, in the array
are not provided, i.e. the names for specimens are not given,
the specimens in the returned matrix, row.names(matrix)
, will be
labelled as '1', '2', and so on.
Sandra Alvarez-Carretero and Mario dos Reis
matrix2array
, write.morpho
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.