R/checkSelect.R

Defines functions .checkSelect

## internal function for checking select arguments in ordination plotting
## functions
.checkSelect <- function(select, scores) {
    ## check `select` and length of scores match
    if(is.logical(select) &&
                 !isTRUE(all.equal(length(select), NROW(scores)))) {
        warning("length of 'select' does not match the number of scores: ignoring 'select'")
    } else {
        scores <- if(is.matrix(scores)) {
            scores[select, , drop = FALSE]
        } else {
            scores[select]
        }
    }
    scores
}

Try the vegan package in your browser

Any scripts or data that you put into this service are public.

vegan documentation built on Sept. 11, 2024, 7:57 p.m.