matrix2array | R Documentation |
Convert a matrix with landmark points into an object of class array.
matrix2array(X, coords = c(2, 3))
X |
Matrix of size |
coords |
Numeric, 2 or 3 for 2D or 3D landmarks, respectively. |
The matrix has format s x n
, with s
rows, one per 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 an example of its format and data-raw/C.R
to
see how this object is generated.
An object of class array with format k x q x s
, where k
is the number of
landmarks, q
the number of coordinates, and s
the number of specimens.
Note that if the matrix provided does not have rownames, the specimens in the
returned array (names for the 's' matrices accessed through the array, i.e.
dimnames( array )[ 3 ]
will be labelled as '1', '2', and so on.
See object C.arr.unal
for an example of the format of the object that is
returned and data-raw/C.R
for the description of how to
obtain this object.
Sandra Alvarez-Carretero and Mario dos Reis
array2matrix
, write.morpho
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.