[Adephylo-commits] r98 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Dec 13 18:25:58 CET 2008


Author: jombart
Date: 2008-12-13 18:25:58 +0100 (Sat, 13 Dec 2008)
New Revision: 98

Modified:
   pkg/R/ppca.R
   pkg/man/ppca.Rd
Log:
Fixes for ppca doc. axis-> axes in args.


Modified: pkg/R/ppca.R
===================================================================
--- pkg/R/ppca.R	2008-12-13 17:13:22 UTC (rev 97)
+++ pkg/R/ppca.R	2008-12-13 17:25:58 UTC (rev 98)
@@ -146,15 +146,15 @@
 #####################
 # Function scatter.ppca
 #####################
-scatter.ppca <- function(x, axis=1:ncol(x$li), useLag=FALSE, ...){
+scatter.ppca <- function(x, axes=1:ncol(x$li), useLag=FALSE, ...){
     if(useLag){
         df <- as.data.frame(x$ls)
     } else{
         df <- as.data.frame(x$li)
     }
 
-    if(any(axis < 1 | axis > ncol(x$li)) ) stop("Wrong axis specified.")
-    df <- df[, axis, drop=FALSE]
+    if(any(axes < 1 | axes > ncol(x$li)) ) stop("Wrong axes specified.")
+    df <- df[, axes, drop=FALSE]
 
     obj <- phylo4d(x$tre,df)
     args <- list(...)
@@ -180,8 +180,8 @@
   cat(class(x))
   cat("\n$call: ")
   print(x$call)
-  cat("\n$nfposi:", x$nfposi, "axis-components saved")
-  cat("\n$nfnega:", x$nfnega, "axis-components saved")
+  cat("\n$nfposi:", x$nfposi, "axes-components saved")
+  cat("\n$nfnega:", x$nfnega, "axes-components saved")
   cat("\n$kept.axes: index of kept axes")
 
   cat("\nPositive eigenvalues: ")
@@ -425,7 +425,7 @@
     cexLabel <- 1
     cexSymbol <- 1
 
-    temp <- try(scatter(x, axis=axes, ratio.tree=ratioTree,
+    temp <- try(scatter(x, axes=axes, ratio.tree=ratioTree,
                         cex.lab=cexLabel, cex.sym=cexSymbol,
                         show.node=FALSE, useLag=useLag), silent=TRUE) # try default plot
     scatterOk <- !inherits(temp,"try-error")
@@ -444,7 +444,7 @@
         }
         cexSymbol <- cexSymbol - .05
 
-        temp <- try(scatter(x, axis=axes, ratio.tree=ratioTree,
+        temp <- try(scatter(x, axes=axes, ratio.tree=ratioTree,
                         cex.lab=cexLabel, cex.sym=cexSymbol,
                         show.node=FALSE, useLag=useLag), silent=TRUE) # try default plot
         scatterOk <- !inherits(temp,"try-error")

Modified: pkg/man/ppca.Rd
===================================================================
--- pkg/man/ppca.Rd	2008-12-13 17:13:22 UTC (rev 97)
+++ pkg/man/ppca.Rd	2008-12-13 17:25:58 UTC (rev 98)
@@ -14,9 +14,16 @@
 
   - \code{print.ppca}: prints the ppca content\cr
 
+  - \code{summary.ppca}: provides useful information about a ppca
+    object, including the decomposition of eigenvalues of all axes\cr
+
   - \code{scatter.ppca}: plot principal components using
   \code{\link{s.phylo4d}}\cr
 
+  - \code{screeplot.ppca}: graphical display of the decomposition of
+  pPCA eigenvalues\cr
+
+  - \code{plot.ppca}: several graphics describing a ppca object\cr
 }
 \usage{
 ppca(x, prox=NULL, method=c("patristic","nNodes","oriAbouheif","Abouheif","sumDD"), a=1,
@@ -24,7 +31,13 @@
 
 \method{print}{ppca}(x, \dots)
 
-\method{plot}{ppca}(x, axis = 1:ncol(x$li), useLag=FALSE, \dots)
+\method{summary}{ppca}(object, \dots, printres=TRUE)
+
+\method{scatter}{ppca}(x, axes = 1:ncol(x$li), useLag = FALSE,\dots)
+
+\method{screeplot}{ppca}(x, \dots, main=NULL)
+
+\method{plot}{ppca}(x, axes = 1:ncol(x$li), useLag=FALSE, \dots)
 }
 \arguments{
   \item{x}{a \linkS4class{phylo4d} object (for \code{ppca}) or a ppca
@@ -54,10 +67,15 @@
   \item{nfnega}{an integer giving the number of negative eigenvalues retained
     ('local structures').}
   \item{\dots}{further arguments passed to other methods. Can be used to
-  provide arguments to \code{\link{s.phylo4d}} in \code{plot} method.}
-  \item{axis}{the index of the principal components to be represented.}
+    provide arguments to \code{\link{s.phylo4d}} in \code{plot} method.}
+  \item{printres}{a logical stating whether results should be printed on
+    the screen (TRUE, default) or not (FALSE).}
+  \item{axes}{the index of the principal components to be represented.}
   \item{useLag}{a logical stating whether the lagged components
-    (\code{x\$ls}) should be used instead of the components (\code{x\$li}).}
+    (\code{x\$ls}) should be used instead of the components
+    (\code{x\$li}).}
+   \item{main}{a title for the screeplot; if NULL, a default one is
+    used.}
 }
 \details{
   The phylogenetic Principal Component Analysis (pPCA, Jombart et al.,
@@ -147,17 +165,14 @@
 ppca1
 
 ## some graphics
-par(mar=omar)
-barplot(ppca1$eig, main="Eigenvalues") # screeplot
+screeplot(ppca1)
+scatter(ppca1, useLag=TRUE)
+plot(ppca1, useLag=TRUE)
 
+## most structured traits
 a <- ppca1$c1[,1] # loadings on PC 1
 names(a) <- row.names(ppca1$c1)
-dotchart(a) # plot of loadings
-abline(v=median(a), lty=3)
 highContrib <- a[a< quantile(a,0.1) | a>quantile(a,0.9)]
-
-plot(ppca1) # ppca plot
-
 datSel <- cbind.data.frame(dat[, names(highContrib)], ppca1$li)
 temp <- phylo4d(tre, datSel)
 s.phylo4d(temp) # plot of most structured traits



More information about the Adephylo-commits mailing list