check.nmatrix | R Documentation |
This is a programmer's utility function to check whether the argument is a numeric vector of the correct length.
check.nmatrix(m, npoints = NULL, fatal = TRUE, things = "data points",
naok = FALSE, squarematrix = TRUE, matchto = "nrow",
warn = FALSE, mname)
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 |
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.
A logical value indicating whether all the requirements were satisfied.
.
check.nvector
z <- matrix(1:16, 4, 4)
check.nmatrix(z, 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.