[Vegan-commits] r260 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Mar 13 14:29:18 CET 2008
Author: jarioksa
Date: 2008-03-13 14:29:18 +0100 (Thu, 13 Mar 2008)
New Revision: 260
Modified:
pkg/R/plot.betadiver.R
pkg/R/scores.betadiver.R
pkg/man/betadiver.Rd
Log:
minor tweaking & new keyword 'triangular' to select either plotting scores or raw scores in betadiver
Modified: pkg/R/plot.betadiver.R
===================================================================
--- pkg/R/plot.betadiver.R 2008-03-10 15:04:39 UTC (rev 259)
+++ pkg/R/plot.betadiver.R 2008-03-13 13:29:18 UTC (rev 260)
@@ -1,18 +1,20 @@
`plot.betadiver` <-
- function(x, ...)
+ function (x, ...)
{
xy <- scores(x, ...)
- plot(c(0,1),c(0,sqrt(0.75)), type="n", axes=FALSE, xlab="", ylab="",
- asp=1)
- for(tic in seq(0.2,0.8, by=0.2)) {
- segments(tic, 0, tic/2 , sqrt(0.75)*tic, lty=3)
- segments(tic/2, sqrt(0.75)*tic, 1-tic/2, sqrt(0.75)*tic, lty=3)
- segments(tic, 0, tic/2+0.5, sqrt(0.75)*(1-tic), lty=3)
+ plot(c(0, 1), c(0, sqrt(0.75)), type = "n", axes = FALSE,
+ xlab = "", ylab = "", asp = 1)
+ for (tic in seq(0.2, 0.8, by = 0.2)) {
+ segments(tic, 0, tic/2, sqrt(0.75) * tic, lty = 3)
+ segments(tic/2, sqrt(0.75) * tic, 1 - tic/2, sqrt(0.75) *
+ tic, lty = 3)
+ segments(tic, 0, tic/2 + 0.5, sqrt(0.75) * (1 - tic),
+ lty = 3)
}
- text(c(0,1,0.5), c(0,0,sqrt(0.75)), c("b'","c'","a'"), pos=c(2,4,3),
- cex=par("cex.axis"))
- lines(c(0,1,0.5,0), c(0,0,sqrt(0.75),0), xpd=TRUE)
+ text(c(0, 1, 0.5), c(0, 0, sqrt(0.75)), c("b'", "c'", "a'"),
+ pos = c(2, 4, 3), cex = par("cex.axis"), xpd=TRUE)
+ lines(c(0, 1, 0.5, 0), c(0, 0, sqrt(0.75), 0), xpd = TRUE)
points(xy, ...)
+ class(xy) <- "ordiplot"
invisible(xy)
}
-
Modified: pkg/R/scores.betadiver.R
===================================================================
--- pkg/R/scores.betadiver.R 2008-03-10 15:04:39 UTC (rev 259)
+++ pkg/R/scores.betadiver.R 2008-03-13 13:29:18 UTC (rev 260)
@@ -1,11 +1,15 @@
`scores.betadiver` <-
- function(x, ...)
+ function(x, triangular = TRUE, ...)
{
- tot <- x$a + x$b + x$c
- a <- x$a/tot
- c <- x$c/tot
- y <- sqrt(0.75)*a
- x <- c + a/2
- cbind(x, y)
+ if (triangular) {
+ tot <- x$a + x$b + x$c
+ a <- x$a/tot
+ c <- x$c/tot
+ y <- sqrt(0.75)*a
+ x <- c + a/2
+ out <- cbind(x, y)
+ } else {
+ out <- sapply(x, cbind)
+ }
+ out
}
-
Modified: pkg/man/betadiver.Rd
===================================================================
--- pkg/man/betadiver.Rd 2008-03-10 15:04:39 UTC (rev 259)
+++ pkg/man/betadiver.Rd 2008-03-13 13:29:18 UTC (rev 260)
@@ -15,7 +15,7 @@
\usage{
betadiver(x, index = NA, order = FALSE, help = FALSE, ...)
\method{plot}{betadiver}(x, ...)
-\method{scores}{betadiver}(x, ...)
+\method{scores}{betadiver}(x, triangular = TRUE, ...)
}
\arguments{
@@ -28,7 +28,9 @@
influence the configuration in the triangular plot and non-symmetric
indices. }
\item{help}{Show the numbers, subscript names and the defining
- equations of the indices and exit.}
+ equations of the indices and exit.}
+ \item{triangular}{Return scores suitable for triangular plotting of
+ proportions. If \code{FALSE}, returns a 3-column matrix of raw counts.}
\item{\dots}{ Other arguments to functions. }
}
More information about the Vegan-commits
mailing list