[Adephylo-commits] r63 - in pkg: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Dec 1 17:42:58 CET 2008
Author: jombart
Date: 2008-12-01 17:42:58 +0100 (Mon, 01 Dec 2008)
New Revision: 63
Modified:
pkg/R/s.phylo4d.R
pkg/man/ppca.Rd
Log:
Check ok. ppca ok.
Modified: pkg/R/s.phylo4d.R
===================================================================
--- pkg/R/s.phylo4d.R 2008-12-01 16:11:46 UTC (rev 62)
+++ pkg/R/s.phylo4d.R 2008-12-01 16:42:58 UTC (rev 63)
@@ -11,7 +11,7 @@
## preliminary stuff and checks
if (is.character(chk <- check_phylo4(x))) stop("bad phylo4d object: ",chk)
- if (is.character(chk <- check_data(x))) stop("bad phylo4d object: ",chk)
+ # if (is.character(chk <- check_data(x))) stop("bad phylo4d object: ",chk) <- needed?
if(!require(ape)) stop("the ape package is required")
if(cex.label<0.1) {
@@ -83,8 +83,12 @@
x.inset <- SYMBSCALE * cex.symbol * usr.width / par("pin")[1]
y.inset <- SYMBSCALE * cex.symbol * usr.height / par("pin")[2]
x.base <- plotres$x.lim[2] + x.inset # start plotting from x.base rightwards
- temp <- x at tip.label[which.max(nchar(x at tip.label))] # longest tip label
- lab.width <- strwidth(temp, units="user", cex=cex.label) # compute the width to keep for tip labels
+ if(show.tip.label){
+ temp <- x at tip.label[which.max(nchar(x at tip.label))] # longest tip label
+ lab.width <- strwidth(temp, units="user", cex=cex.label) # compute the width to keep for tip labels
+ } else{
+ lab.width <- 0
+ }
xrange.data <- c(x.base , (par("usr")[1]+usr.width) - lab.width - 2*x.inset) # plot data within this range
if(diff(xrange.data) < (x.inset*ncol(dat))) stop("No room left to plot data; please try reducing ratio.tree or cex.label.")
Modified: pkg/man/ppca.Rd
===================================================================
--- pkg/man/ppca.Rd 2008-12-01 16:11:46 UTC (rev 62)
+++ pkg/man/ppca.Rd 2008-12-01 16:42:58 UTC (rev 63)
@@ -24,7 +24,7 @@
\method{print}{ppca}(x, \dots)
-\method{plot}{ppca}(x, axis = 1, useLag=FALSE, \dots)
+\method{plot}{ppca}(x, axis = 1:ncol(x$li), useLag=FALSE, \dots)
}
\arguments{
\item{x}{a \linkS4class{phylo4d} object (for \code{ppca}) or a ppca
@@ -32,6 +32,15 @@
\item{prox}{a marix of phylogenetic proximities as returned by
\code{\link{proxTips}}. If not provided, this matrix will be
constructed using the arguments \code{method} and \code{a}.}
+ \item{method}{a character string (full or abbreviated without
+ ambiguity) specifying the method used to compute proximities;
+ possible values are:\cr
+ - \code{patristic}: (inversed sum of) branch lengths \cr
+ - \code{nNodes}: (inversed) number of nodes on the path between the nodes \cr
+ - \code{Abouheif}: Abouheif's proximity (see details) \cr
+ - \code{sumDD}: (inversed) sum of direct descendants of all nodes on the path
+ (see details in \code{\link{proxTips}}).}
+ \item{a}{the exponent used to compute the proximity (see ?\code{\link{proxTips}}).}
\item{center}{a logical indicating whether traits should be centred to
mean zero (TRUE, default) or not (FALSE).}
\item{scale}{a logical indicating whether traits should be scaled to
@@ -133,6 +142,7 @@
## compute a PCA
dat <- apply(maples$tab,2,f1) # replace NAs
x.noNA <- phylo4d(tre, as.data.frame(dat))
+if(require(ade4)){
ppca1 <- ppca(x.noNA, scannf=FALSE, method="Abouheif")
ppca1
@@ -148,13 +158,13 @@
plot(ppca1) # ppca plot
-datSel <- cbind.data.frame(ppca1$li, dat[, names(highContrib)])
-temp <- phylo4d(tre, datSel))
+datSel <- cbind.data.frame(dat[, names(highContrib)], ppca1$li)
+temp <- phylo4d(tre, datSel)
s.phylo4d(temp) # plot of most structured traits
## phylogenetic autocorrelation tests for these traits
prox <- proxTips(tre, method="Abouheif")
gearymoran(prox, dat[, names(highContrib)]) # one test per trait
-
}
+}
\keyword{multivariate}
\ No newline at end of file
More information about the Adephylo-commits
mailing list