R/stepacross.R

"stepacross" <-
    function (dis, path = "shortest", toolong = 1, trace = TRUE, ...) 
{
    path <- match.arg(path, c("shortest", "extended"))
    if (!inherits(dis, "dist")) 
        dis <- as.dist(dis)
    oldatt <- attributes(dis)
    n <- attr(dis, "Size")
    if (path == "shortest") 
        dis <- .C("dykstrapath", dist = as.double(dis), n = as.integer(n), 
                  as.double(toolong), as.integer(trace), out = double(length(dis)), 
                  NAOK = TRUE, PACKAGE = "vegan")$out
    else dis <- .C("stepacross", dis = as.double(dis), as.integer(n), 
                   as.double(toolong), as.integer(trace), NAOK = TRUE, PACKAGE = "vegan")$dis
    attributes(dis) <- oldatt
    attr(dis, "method") <- paste(attr(dis, "method"), path)
    dis
}

Try the vegan package in your browser

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

vegan documentation built on May 2, 2019, 5:51 p.m.