Skip to content

Commit

Permalink
allow getting pure scores matrix of weighted wcmdscale
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://svn.r-forge.r-project.org/svnroot/vegan/pkg/vegan@2476 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
  • Loading branch information
jarioksa committed Mar 9, 2013
1 parent 62ee181 commit e6c661f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
4 changes: 2 additions & 2 deletions R/wcmdscale.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function(d, k, eig = FALSE, add = FALSE, x.ret = FALSE, w)
if (add)
.NotYetUsed("add")
## Force eig=TRUE if add, x.ret or !missing(w)
if(add || x.ret || !missing(w))
if(x.ret)
eig <- TRUE
ZERO <- sqrt(.Machine$double.eps)
if (!inherits(d, "dist")) {
Expand Down Expand Up @@ -50,7 +50,7 @@ function(d, k, eig = FALSE, add = FALSE, x.ret = FALSE, w)
## GOF for real and all axes
GOF <- c(sum(ev)/sum(abs(e$values)),
sum(ev)/sum(e$values[e$values > 0]))
if (eig || x.ret || add) {
if (eig || x.ret) {
colnames(points) <- paste("Dim", seq_len(NCOL(points)), sep="")
out <- list(points = points, eig = if (eig) e$values,
x = if (x.ret) m, ac = NA, GOF = GOF, weights = w,
Expand Down
5 changes: 5 additions & 0 deletions inst/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ Version 2.1-27 (opened Februray 22, 2013)
* text.cca, points.cca: gained argument 'axis.bp' (defaults TRUE)
to suppress drawing axes for scaled biplot arrows. Only effective
if 'bp' scores were requested.

* wcmdscale: setting only weights 'w' does not force full
"wcmdscale" output but returns only the matrix of coordinates of
real axes. Similarly, setting 'add = TRUE' would not force
"wcmdscale", but 'add' is not implemented.

Version 2.1-26 (opened February 11, 2013)

Expand Down
19 changes: 10 additions & 9 deletions man/wcmdscale.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,18 @@ wcmdscale(d, k, eig = FALSE, add = FALSE, x.ret = FALSE, w)

With default options, the function returns only a matrix of scores
scaled by eigenvalues for all real axes. If the function is called
with \code{eig = TRUE} or \code{x.ret = TRUE} or with weights
\code{w}, the function returns an object of class \code{"wcmdscale"}
with \code{print}, \code{plot}, \code{scores}, \code{\link{eigenvals}}
and \code{\link{stressplot}} methods, and described in section Value.
}
with \code{eig = TRUE} or \code{x.ret = TRUE}, the function returns
an object of class \code{"wcmdscale"} with \code{print},
\code{plot}, \code{scores}, \code{\link{eigenvals}} and
\code{\link{stressplot}} methods, and described in section Value.
}

\value{ If \code{eig = FALSE} and \code{x.ret = FALSE} (default), a
matrix with \code{k} columns whose rows give the coordinates of the
points chosen to represent the dissimilarities. Otherwise, an
object of class \code{wcmdscale} containing the components that are
mostly similar as in \code{\link{cmdscale}}:
matrix with \code{k} columns whose rows give the coordinates of
points corresponding to positive eignenvalues. Otherwise, an object
of class \code{wcmdscale} containing the components that are mostly
similar as in \code{\link{cmdscale}}:

\item{points}{a matrix with \code{k} columns whose rows give the
coordinates of the points chosen to represent the
dissimilarities.}
Expand Down

0 comments on commit e6c661f

Please sign in to comment.