Data Editing Support Library

DESCRIPTION:

Determines the validity of an attempt to specify indices.

USAGE:

valid.rowcol(index, count=<<see below>>, max.rowcol=<<see below>>, 
             count.must.exist=F) 

REQUIRED ARGUMENTS:

index
integer vector containing the results of an attempt to specify indices; this is typically the return value of a prior call to index.rowcol.

OPTIONAL ARGUMENTS:

count
integer value specifying the number of indices to validate when index contains the results of an attempt to specify a starting index. The default is 1.
max.rowcol
integer value specifying the maximum value that any element of index (and, if count.must.exist=T, of the sequence starting at index of length count) is allowed to be. The default is Inf.
count.must.exist
logical flag: if TRUE and count is specified, valid.rowcol will determine the validity of all elements in the sequence starting at index of length count.

VALUE:

if index and (if count.must.exist=T) the sequence starting at index of length count are valid (i.e., within the range 1 to max.rowcol and index of non-zero length), logical value indicating whether count is non-zero; otherwise, an error occurs with one of three messages:
- "Non-existent row/column specified"
- "Out-of-range row/column specified"
- "Out-of-range count specified"

SEE ALSO:

, , .

EXAMPLES:

# typical way to allow/verify row selection by name or number 
"row.select"<- 
function(x, select.spec) 
{ 
        select.spec <- index.rowcol(x, select.spec, which="rows") 
        valid.rowcol(select.spec, 1, count.rows(x), T) 
        select.rows(x, select.spec) 
}