diff --git a/R/dist2xy.R b/R/dist2xy.R index 4f5952518..761f44e6d 100644 --- a/R/dist2xy.R +++ b/R/dist2xy.R @@ -51,6 +51,7 @@ type <- match.arg(type) if (!inherits(dist, "dist")) stop("'dist' must be a dissimilarity object of class 'dist'") + att <- attributes(dist) dist <- as.matrix(dist) n <- nrow(dist) ## make up the selection vector @@ -59,9 +60,13 @@ if (invert) k <- !k ## make compartments - if (type == "xy") - dist[k, !k, drop = FALSE] - else - as.dist(dist[k, k, drop = FALSE]) + dist <- if (type == "xy") + dist[k, !k, drop = FALSE] + else + as.dist(dist[k, k, drop = FALSE]) + attr(dist, "call") <- match.call() + attr(dist, "method") <- att$method + attr(dist, "maxdist") <- att$maxdist + dist } diff --git a/tests/Examples/vegan-Ex.Rout.save b/tests/Examples/vegan-Ex.Rout.save index b75c69ff7..ef5e9a63f 100644 --- a/tests/Examples/vegan-Ex.Rout.save +++ b/tests/Examples/vegan-Ex.Rout.save @@ -187,17 +187,17 @@ adj. RDA R squares -0.12553 -0.0250 > MDSaddpoints(mod3, dist2xy(d, 3)) $points MDS1 MDS2 -3 -0.04351138 -0.2040447 +3 -0.09726945 -0.4560911 $seed - [,1] [,2] -[1,] 0.005468615 -0.1947698 + [,1] [,2] +[1,] 0.01222408 -0.435372 $deltastress [1] 0.001811369 $iters -[1] 16 +[1] 18 $cause [1] 4 @@ -8948,7 +8948,7 @@ Procrustes sum of squares: > cleanEx() > options(digits = 7L) > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n") -Time elapsed: 8.578 0.271 8.874 0 0 +Time elapsed: 8.559 0.295 8.885 0 0 > grDevices::dev.off() null device 1