diag.bathy {marmap} | R Documentation |
Finds matrix diagonal for non-square matrices
Description
Finds either the values of the coordinates of the non-linear diagonal of non-square matrices.
Usage
diag.bathy(mat,coord=FALSE)
Arguments
mat |
a data matrix |
coord |
whether of not to output the coordinates of the diagonal (default is |
Details
diag.bathy gets the values or coordinates from the first element of a matrix to its last elements. If the matrix is non-square, that is, its number of rows and columns differ, diag.bathy computes an approximate diagonal.
Value
A vector of diagonal values is coord
is FALSE
, or a table of diagonal coordinates ifcoord
is FALSE
Author(s)
Eric Pante
See Also
Examples
# a square matrix: diag.bathy behaves as diag
matrix(1:25, 5, 5) -> a ; a
diag(a)
diag.bathy(a)
# a non-square matrix: diag.bathy does not behaves as diag
matrix(1:15, 3, 5) -> b ; b
diag(b)
diag.bathy(b)
# output the diagonal or its coordinates:
rownames(b) <- seq(32,35, length.out=3)
colnames(b) <- seq(-100,-95, length.out=5)
diag.bathy(b, coord=FALSE)
diag.bathy(b, coord=TRUE)
[Package marmap version 1.0.10 Index]