check.nmatrix {spatstat.utils} | R Documentation |
Check for Numeric Matrix with Correct Dimensions
Description
This is a programmer's utility function to check whether the argument is a numeric vector of the correct length.
Usage
check.nmatrix(m, npoints = NULL, fatal = TRUE, things = "data points",
naok = FALSE, squarematrix = TRUE, matchto = "nrow",
warn = FALSE, mname)
Arguments
m |
The argument to be checked. |
npoints |
The required number of rows and/or columns for the matrix |
fatal |
Logical value indicating whether to stop with an error message
if |
things |
Character string describing what the rows/columns of |
naok |
Logical value indicating whether |
squarematrix |
Logical value indicating whether |
matchto |
Character string (either |
warn |
Logical value indicating whether to issue a warning
if |
mname |
Optional character string giving the name of |
Details
This programmer's utility function checks whether m
is a numeric matrix
of the correct dimensions, and checks for NA
values.
If matchto="nrow"
(the default) then
the number of rows of m
must be equal to npoints
.
If matchto="ncol"
then the number of columns of m
must be equal to npoints
. If squarematrix=TRUE
(the
default) then the numbers of rows and columns must be equal.
If naok = FALSE
(the default) then the entries of m
must not include NA
.
If these requirements are all satisfied, the result is the logical
value TRUE
.
If not, then if fatal=TRUE
(the default), an error occurs;
if fatal=FALSE
, the result is the logical value FALSE
with an attribute describing the requirement that was not satisfied.
Value
A logical value indicating whether all the requirements were satisfied.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au.
See Also
Examples
z <- matrix(1:16, 4, 4)
check.nmatrix(z, 4)