Skip to content

Commit

Permalink
Merge branch 'dist2-attributes'
Browse files Browse the repository at this point in the history
  • Loading branch information
jarioksa committed May 28, 2024
2 parents 3f101c0 + bb8b707 commit 28a0320
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 9 additions & 4 deletions R/dist2xy.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

10 changes: 5 additions & 5 deletions tests/Examples/vegan-Ex.Rout.save
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 28a0320

Please sign in to comment.