\name{PI2newick}
\alias{PI2newick}
\title{Import data files from Phylogenetic Independance Package}
\description{
This function ensures to transform a data set written for the Phylogenetic Independance package of Abouheif (1999) in a data set formatting for the functions of ade4.
}
\usage{
PI2newick(x)
}
\arguments{
  \item{x}{is a data frame that contains information on phylogeny topology and trait values}
}
\value{
Returns a list containing :
  \item{tre}{: a character string giving the phylogenetic tree in Newick format}
  \item{trait}{: a vector containing values of the trait}
}
\references{
Abouheif, E. (1999) A method for testing the assumption of phylogenetic independence in comparative data. \emph{Evolutionary Ecology Research}, \bold{1}, 895--909.
}
\author{Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr} \cr
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
x <- c(2.0266, 0.5832, 0.2460, 1.2963, 0.2460, 0.1565, -99.0000,
        -99.0000, 10.1000, -99.0000,  20.2000,  28.2000, -99.0000, 
        14.1000, 11.2000, -99.0000, 21.3000, 27.5000, 1.0000, 2.0000,
        -1.0000, 4.0000, -1.0000, -1.0000, 3.0000, -1.0000, -1.0000,
        5.0000, -1.0000, -1.0000, 0.0000, 0.0000, 0.0000, 0.0000,
        0.0000, 0.0000)
x <- matrix(x, nrow = 6)
x <- as.data.frame(x)
res <- PI2newick(x)
dotchart.phylog(newick2phylog(res$tre), res$trait)
}
\keyword{manip}

\eof
\name{RV.rtest}
\alias{RV.rtest}
\title{Monte-Carlo Test on the sum of eigenvalues of a co-inertia analysis (in R).}
\description{
performs a Monte-Carlo Test on the sum of eigenvalues of a co-inertia analysis. 
}
\usage{
RV.rtest(df1, df2, nrepet = 99)
}
\arguments{
  \item{df1, df2}{two data frames with the same rows}
  \item{nrepet}{the number of permutations}
}
\value{
returns a list of class 'rtest'
}
\references{
Heo, M. & Gabriel, K.R. (1997) A permutation test of association between configurations by means of the RV coefficient. 
Communications in Statistics - Simulation and Computation, \bold{27}, 843-856.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(doubs)
pca1 <- dudi.pca(doubs$mil, scal = TRUE, scann = FALSE)
pca2 <- dudi.pca(doubs$poi, scal = FALSE, scann = FALSE)
rv1 <- RV.rtest(pca1$tab, pca2$tab, 99)
rv1
plot(rv1)
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{RVdist.randtest}
\alias{RVdist.randtest}
\title{Tests of randomization on the correlation between two distance matrices (in R).}
\description{
performs a RV Test between two distance matrices. 
}
\usage{
RVdist.randtest(m1, m2, nrepet = 999)
}
\arguments{
  \item{m1, m2}{two Euclidean matrices}
  \item{nrepet}{the number of permutations}
}
\value{
returns a list of class 'randtest'
}
\references{
Heo, M. & Gabriel, K.R. (1997) A permutation test of association between configurations by means of the RV coefficient. 
Communications in Statistics - Simulation and Computation, \bold{27}, 843-856.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{abouheif.eg}
\alias{abouheif.eg}
\docType{data}
\title{Phylogenies and quantitative traits from Abouheif}
\description{
This data set gathers three phylogenies with three sets of traits as reported by Abouheif (1999).
}
\usage{data(abouheif.eg)}
\format{
\code{abouheif.eg} is a list containing the 6 following objects :  
\describe{
   \item{tre1}{is a character string giving the first phylogenetic tree made up of 8 leaves.}  
   \item{vec1}{is a numeric vector with 8 values.} 
   \item{tre2}{is a character string giving the second phylogenetic tree made up of 7 leaves.}
   \item{vec2}{is a numeric vector with 7 values.} 
   \item{tre3}{is a character string giving the third phylogenetic tree made up of 15 leaves.}
   \item{vec3}{is a numeric vector with 15 values.} 
}}
\source{
Data taken from the phylogenetic independence program developped by Ehab Abouheif starting from \url{http://ww2.mcgill.ca/biology/faculty/abouheif/programs.html}.
}
\references{
Abouheif, E. (1999) A method for testing the assumption of phylogenetic independence in comparative data. \emph{Evolutionary Ecology Research}, \bold{1}, 895--909.
}
\examples{
data(abouheif.eg)
par(mfrow=c(2,2))
symbols.phylog(newick2phylog(abouheif.eg$tre1), abouheif.eg$vec1,
 sub = "Body Mass (kg)", csi = 2, csub = 2)
symbols.phylog(newick2phylog(abouheif.eg$tre2), abouheif.eg$vec2,
 sub = "Body Mass (kg)", csi = 2, csub = 2)
dotchart.phylog(newick2phylog(abouheif.eg$tre1), abouheif.eg$vec1,
 sub = "Body Mass (kg)", cdot = 2, cnod = 1, possub = "topleft",
  csub = 2, ceti = 1.5)
dotchart.phylog(newick2phylog(abouheif.eg$tre2), abouheif.eg$vec2,
 sub = "Body Mass (kg)", cdot = 2, cnod = 1, possub = "topleft",
  csub = 2, ceti = 1.5)
par(mfrow = c(1,1))

w.phy=newick2phylog(abouheif.eg$tre3)
dotchart.phylog(w.phy,abouheif.eg$vec3, clabel.n = 1)
}
\keyword{datasets}

\eof
\name{acacia}
\alias{acacia}
\docType{data}
\title{Spatial pattern analysis in plant communities}
\description{
Counts of individuals of \emph{Acacia ehrenbergiana} from five parallel transects of 32 quadrats.
}
\usage{data(acacia)}
\format{
\code{acacia} is a data frame with 15 variables :\cr
se.T1, se.T2, se.T3, se.T4, se.T5 are five numeric vectors containing quadrats counts of 
seedlings from transects 1 to 5 respectively;\cr
sm.T1, sm.T2, sm.T3, sm.T4, sm.T5 are five numeric vectors containing quadrats counts of
 small trees (crown < 1 \eqn{m^{2}}{m^2} in canopy) of transects 1 to 5 respectively; \cr
la.T1, la.T2, la.T3, la.T4, la.T5 are five numeric vectors containing quadrats counts of 
trees with large crown (crown > 1 \eqn{m^{2}}{m^2} in canopy) of transects 1 to 5 respectively.
}
\source{
Greig-Smith, P. and Chadwick, M.J. (1965) Data on pattern within plant communities. III. \emph{Acacia-Capparis} semi-desert scrub in the Sudan. \emph{Journal of Ecology}, \bold{53}, 465--474.

Hill, M.O. (1973) The intensity of spatial pattern in plant communities. \emph{Journal of Ecology}, \bold{61}, 225--235.
}
\examples{
data(acacia)
par(mfcol=c(5,3))
par(mar = c(2,2,2,2))
for(k in 1:15) {
    barplot(acacia[,k],ylim=c(0,20),col=grey(0.8))
    scatterutil.sub(names(acacia)[k],1.5,"topleft")
}
par(mfcol=c(1,1))}
\keyword{datasets}

\eof
\name{ade4toR}
\alias{ade4toR}
\alias{Rtoade4}
\title{Format Change Utility}
\description{
  Exchange objects between R and ADE4 (classic version) \cr
  \url{http://pbil.univ-lyon1.fr/ADE-4} 
}
\usage{
ade4toR (fictab, ficcolnames = NULL, ficrownames = NULL)
Rtoade4 (x)
}
\arguments{
  \item{fictab}{a name of ADE4 text file.  A data frame with the same name is created in the R environment.} 
  \item{ficcolnames}{the column names label file}
  \item{ficrownames}{the row names label file}
  \item{x}{a data frame}
}
\value{
 'ade4toR' gives data frames.\cr
  'Rtoade4' gives text files.
}
\details{
"xxx" is the name of object x (\code{(deparse(substitute(x)))})\cr
For any table :\cr
    creates a file "xxx.txt"\cr
    creates a file "xxx\_row\_lab.txt" with row names\cr
    creates a file "xxx\_col\_lab.txt" with column names\cr

if x has the 'col.blocks' attribute\cr
creates a file "xxx\_col\_bloc\_lab.txt" with blocks names\cr
creates a file "xxx\_col\_bloc.txt" with blocks sizes\cr

For a table which all columns are factors : \cr
creates a file "xxx.txt"\cr
creates a file "xxx\_var\_lab.txt" with row names\cr
creates a file "xxx\_moda\_lab.txt" with categories names\cr

Files are created in the current working directory.
}
\examples{
data(tarentaise)
traits <- tarentaise$traits
Rtoade4(traits)
# File creation traits.txt 
# File creation traits_col_lab.txt 
# File creation traits_row_lab.txt 
# File creation traits_col_bloc.txt 
# File creation traits_col_bloc_lab.txt  

mil <- tarentaise$envir
Rtoade4(mil)
#File creation mil.txt 
#File creation mil_var_lab.txt 
#File creation mil_moda_lab.txt 
}
\keyword{utilities}

\eof
\name{aminoacyl}
\alias{aminoacyl}
\docType{data}
\title{Codon usage}
\description{
        \code{aminoacyl} is a list containing the codon counts of 36 genes encoding yeast aminoacyl-tRNA-synthetase(S.Cerevisiae).
}
\usage{data(aminoacyl)}
\format{
   \code{aminoacyl} is a list containing the 5 following objects:  
\describe{     
   \item{genes}{is a vector giving the gene names.} 
   \item{localisation}{is a vector giving the cellular localisation
         of the proteins (M = mitochondrial, C = cytoplasmic,
         I = indetermined, CI = cyto and mito).}    
   \item{codon}{is a vector containing the codon.}
   \item{AA}{is a factor giving the amino acid names for each codon.}
   \item{usage.codon}{is a dataframe containing the codon counts for each gene.}
 } 
}
\source{
 Data prepared by D. Charif \email{charif@biomserv.univ-lyon1.fr} starting from:\cr
 \url{http://www.expasy.org/sprot/}
}
\references{
Chiapello H., Olivier E., Landes-Devauchelle C., Nitschké P. and Risler J.L (1999) Codon usage as a tool to predict the cellular localisation of eukariotic ribosomal proteins and aminoacyl-tRNA synthetases. ,\emph{Nucleic Acids Res.}, \bold{27}, 14, 2848--2851.
}
\examples{
data(aminoacyl)
aminoacyl$genes
aminoacyl$usage.codon
dudi.coa(aminoacyl$usage.codon, scannf = FALSE)
}
\keyword{datasets}

\eof
\name{amova}
\alias{amova}
\alias{print.amova}
\title{Analysis of molecular variance}
\description{
The analysis of molecular variance tests the differences among population and/or groups of populations
in a way similar to ANOVA. It includes evolutionary distances among alleles.
}
\usage{
amova(samples, distances, structures)
print.amova(x, full = FALSE, \dots)
}
\arguments{
  \item{samples}{a data frame with haplotypes (or genotypes) as rows, populations as columns
  and abundance as entries}
  \item{distances}{an object of class \code{dist} computed from Euclidean distance.
  If \code{distances} is null, equidistances are used.}
  \item{structures}{a data frame containing, in the jth row and the kth column,
  the name of the group of level k to which the jth population belongs}
  \item{x}{an object of class \code{amova}}
  \item{full}{a logical value indicating whether the original data ('distances','samples','structures')
  should be printed}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
Returns a list of class \code{amova}
  \item{call}{call}
  \item{results}{a data frame with the degrees of freedom, the sums of squares, and the mean squares.
  Rows represent levels of variability.}
  \item{componentsofcovariance}{a data frame containing the components
  of covariance and their contribution to the total covariance}
  \item{statphi}{a data frame containing the phi-statistics}
}
\references{
Excoffier, L., Smouse, P.E. and Quattro, J.M. (1992) Analysis of molecular variance inferred
from metric distances among DNA haplotypes: application to human mitochondrial DNA restriction
data. \emph{Genetics}, \bold{131}, 479--491.
}
\author{Sandrine Pavoine \email{pavoine@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{randtest.amova}}}
\examples{
data(humDNAm)
amovahum <- amova(humDNAm$samples, sqrt(humDNAm$distances), humDNAm$structures)
amovahum
}
\keyword{multivariate}

\eof
\name{apis108}
\docType{data}
\alias{apis108}
\title{Allelic frequencies in ten honeybees populations at eight microsatellites loci}
\description{
This data set gives the occurences for the allelic form on 8 loci in 10 populations.
} 
\usage{data(apis108)} 
\format{
A data frame containing 180 rows (allelic forms on 8 loci) and 10 columns (populations).
} 
\source{
\url{http://www.montpellier.inra.fr/URLB/apis/libanfreq.pdf}\cr

Franck P., Garnery L., Solignac M. and Cornuet J.M. (2000) Molecular confirmation of a fourth lineage in honeybees from the Near-East. 
\emph{Apidologie}, \bold{31}, 167--180.
}
\examples{
data(apis108)
apis <- count2genet(as.data.frame(t(apis108)))
apis.pca <- dudi.pca(apis$tab, center = apis$center,
    scale = FALSE, scannf = FALSE, nf = 3)
} 
\keyword{datasets}

\eof
\name{ardeche}
\alias{ardeche}
\docType{data}
\title{Fauna Table with double (row and column) partitioning}
\description{
  This data set gives informations about species in different sites and dates. 
}
\usage{data(ardeche)}
\format{
  \code{ardeche} is a list with 6 components.
  \describe{
    \item{tab}{is a data frame containing fauna table with 43 species (rows) and 35 sites (columns).}
    \item{col.blocks}{is a vector containing the number of columns in the 6 groups.}
    \item{row.blocks}{is a vector containing the number of rows in the 4 groups.}
    \item{dat.fac}{is a dates factor for samples (6 dates).}
    \item{sta.fac}{is a sites factor for samples (6 sites).}
    \item{esp.fac}{is a species order factor (Ephemeroptera, Plecoptera, Coleoptera, Trichoptera).}
  }
}
\source{
 Cazes, P., Chessel, D., and Dolédec, S. (1988) L'analyse des correspondances internes d'un tableau partitionné :
 son usage en hydrobiologie. \emph{Revue de Statistique Appliquée}, \bold{36}, 39--54.
}
\examples{
data(ardeche)
dudi1 <- dudi.coa(ardeche$tab, scan = FALSE)
s.class(dudi1$co, ardeche$dat.fac)
s.label(dudi1$co, clab = 0.5, add.p = TRUE)
}
\keyword{datasets}

\eof
\name{area.plot}
\alias{area.plot}
\alias{poly2area}
\alias{area2poly}
\alias{area2link}
\alias{area.util.contour}
\alias{area.util.xy}
\title{Graphical Display of Areas}
\description{
'area' is a data frame with three variables.\cr
The first variable is a factor defining the polygons.\cr
The second and third variables are the xy coordinates of the
polygon vertices in the order where they are found.

area.plot : grey levels areas mapping

poly2area takes an object of class 'polylist' (spdep package, that contains the
older package 'spweights') and returns a data frame of type area.\cr
area2poly takes an object of type 'area' and returns a list of class 'polylist'\cr
area2link takes an object of type 'area' and returns a proximity matrix which terms are given by the length of the frontier between two polygons. \cr
area.util.contour and area.util.xy are two utility functions.
}
\usage{
area.plot(x, center = NULL, values = NULL, graph = NULL, lwdgraph = 2,
nclasslegend = 8, clegend = 0.75, sub = "", csub = 1, 
possub = "topleft", cpoint = 0, label = NULL, clabel = 0, ...)

area2poly(area)
poly2area(polys)
area2link(area)
area.util.contour(area)
area.util.xy(area)
}
\arguments{
\item{x}{a data frame with three variables}
\item{center}{a matrix with the same row number as x and two columns, the coordinates
of polygone centers. If NULL, it is computed with \code{area.util.xy}}
\item{values}{if not NULL, a vector which values will be mapped to grey levels.
The values must be in the same order as the values in \code{unique(x.area[,1])}}
\item{graph}{if not NULL, \code{graph} is a neighbouring graph (object of class "neig") between polygons}
\item{lwdgraph}{a line width to draw the neighbouring graph}
\item{nclasslegend}{if \code{value} not NULL, a number of classes for the legend}
\item{clegend}{if not NULL, a character size for the legend, used with \code{par("cex")*clegend}}
\item{sub}{a string of characters to be inserted as sub-title}
\item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
\item{possub}{a string of characters indicating the sub-titles position 
("topleft", "topright", "bottomleft", "bottomright")}
\item{cpoint}{if positive, a character size for drawing the polygons vertices (check up),
used with \code{par("cex")*cpoint}}
\item{label}{if not NULL, by default the levels of the factor that define the polygons
are used as labels. To change this value, use label. These labels must be in the same order than
\code{unique(x.area[,1])}}
\item{clabel}{if not NULL, a character size for the polygon labels, used with \code{par("cex")*clabel}}
\item{polys}{a list belonging to the 'polylist' class in the spdep package}
\item{area}{a data frame of class 'area'}
\item{\dots}{further arguments passed to or from other methods}
}
\value{
poly2area returns a data frame 'factor,x,y'. \cr
area2poly returns a list of class \code{polylist}. \cr
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(elec88)
par(mfrow = c(2,2))
area.plot(elec88$area, cpoint = 1)
area.plot(elec88$area, lab = elec88$lab, clab = 0.75)
area.plot(elec88$area, clab = 0.75)
# elec88$neig <- neig(area = elec88$area)
area.plot(elec88$area, graph = elec88$neig, 
sub = "Neighbourhood graph", possub = "topright")
par(mfrow = c(1,1))

\dontrun{
par(mfrow = c(3,3))
for (i in 1:9) {
    x <- elec88$tab[,i]
    area.plot(elec88$area, val=x,
    sub = names(elec88$tab)[i], csub = 3, cleg = 1.5)
}

par(mfrow = c(3,3))
for (i in 1:9) {
    x <- elec88$tab[,i]
    s.value(elec88$xy, elec88$tab[,i], contour = elec88$contour,
    meth = "greylevel", sub = names(elec88$tab)[i], csub = 3, 
    cleg = 1.5, incl = FALSE)
}

data(irishdata)
par(mfrow = c(2,2))
w <- area.util.contour(irishdata$area)
xy <- area.util.xy(irishdata$area)
area.plot(irishdata$area, cpoint = 1)
apply(w, 1, function(x) segments(x[1],x[2],x[3],x[4], lwd = 3))
area.plot(irishdata$area, clabel = 1)
s.label(xy, area = irishdata$area, incl = FALSE, clab = 0, 
cpoi = 3, addax = FALSE, contour = w)
s.label(xy, area = irishdata$area, incl = FALSE, 
addax = FALSE, contour = w)
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
    data(columbus)
    par(mfrow = c(2,2))
    plot(col.gal.nb, coords, pch = 20, cex = 2)
    col.gal.neig <- nb2neig(col.gal.nb)
    s.label(data.frame(coords), neig = col.gal.neig,
    inc = FALSE, addax = FALSE, clab = 0, cneig = 1, cpo = 2)
     plot.polylist(polys,bbs)
    area.plot(poly2area(polys))

    # 1
    crime.f <- as.ordered(cut(columbus$CRIME,
    breaks = quantile(columbus$CRIME, probs = seq(0,1,0.2)),
    include.lowest = TRUE))
    colours <- c("salmon1", "salmon2", "red3", "brown", "black")
    plot(bbs[,1], bbs[,4], xlab = "", ylab = "", asp = 1, type = "n",
    xlim = range(c(bbs[,1], bbs[,3])), ylim = range(c(bbs[,2],
     bbs[,4])))
    for (i in 1:length(polys)) 
    polygon(polys[[i]], col = colours[unclass(crime.f[i])])
    legend(x = c(6, 7.75), y = c(13.5, 15), legend = levels(crime.f),
    fill = colours, cex = 0.7)
    title(sub = paste("Columbus OH: residential burglaries and ",
    "vehicle\nthefts", "per thousand households, 1980"))
    
    # 2
    area1 <- poly2area(polys)
    w <- area.util.contour(area1)
    wxy <- area.util.xy(area1)
    area.plot(area1, values = columbus$CRIME, sub = paste("Columbus ",
    "OH: residential burglaries and vehicle\nthefts",
    "per thousand households, 1980"))
    apply(w, 1, function(x) segments(x[1], x[2], x[3], x[4], lwd = 2))

    # 3
    data(elec88)
    fr.area <- elec88$area
    fr.xy <- area.util.xy(fr.area)
    fr.neig <- elec88$neig # neig(area = fr.area)

    # 4
    fr.poly <- area2poly(fr.area)
    fr.nb <- neig2nb(fr.neig)
    plot.polylist(fr.poly, attr(fr.poly, "region.rect"), border = "grey")
    plot(fr.nb, fr.xy, add = TRUE)
    s.label(fr.xy, clab = 0, area = fr.area, neig = fr.neig, 
    cneig = 1, cpo = 2, inc = FALSE, addax = FALSE)
par(mfrow=c(1,1))
}}

data(irishdata)
w <- irishdata$area[c(42:53,18:25),]
w
w$poly <- as.factor(as.character(w$poly))
area.plot(w, clab = 2)
 
points(68, 59, pch = 20, col = "red", cex = 3)
points(68, 35, pch = 20, col = "red", cex = 3)
points(45, 12, pch = 20, col = "red", cex = 3)
sqrt((59-35)^2)+sqrt((68-45)^2+(35-12)^2)
area2link(w)
}
\keyword{hplot}

\eof
\name{arrival}
\alias{arrival}
\docType{data}
\title{Arrivals at an intensive care unit}
\description{
This data set gives arrival times of 254 patients at an intensive care unit during one day.
}
\usage{data(arrival)}
\format{
\code{arrival} is a list containing the 2 following objects : 
\describe{ 
   \item{times}{is a vector giving the arrival times in the form HH:MM} 
   \item{hours}{is a vector giving the number of arrivals per hour for the day considered}
}}
\source{
Data taken from the logiciel Oriana developped by Warren L. Kovach \email{sales@kovcomp.com} starting from \url{http://www.kovcomp.com/oriana/index.html}.
}
\references{
Fisher, N. I. (1993) \emph{Statistical Analysis of Circular Data}. Cambridge University Press. 
}
\examples{
data(arrival)
dotcircle(arrival$hours, pi/2 + pi/12)
}
\keyword{datasets}
\keyword{chron}

\eof
\name{as.taxo}
\alias{as.taxo}
\title{Taxonomy}
\description{
This function creates an object of class \code{taxo} that is a sub-class of \code{data.frame}. Each column of the data frame must be a factor corresponding to a level \emph{j} of the taxonomy (genus, family, \dots).
The levels of factor \emph{j} define some classes that must be completly included in classes of factor \emph{j+1}.
}
\usage{
as.taxo(df)
}
\arguments{
\item{df}{a data frame}
}
\value{
Returns a data.frame of class \code{taxo}.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{taxo2phylog}} to transform an object of class \code{taxo} into an object of class \code{phylog}}.
\examples{
data(taxo.eg)
tax <- as.taxo(taxo.eg[[1]])
tax.phy <- taxo2phylog(as.taxo(taxo.eg[[1]]))
par(mfrow = c(1,2))
plot.phylog(tax.phy, clabel.l = 1.25, clabel.n = 1.25, f = 0.75)
plot.phylog(taxo2phylog(as.taxo(taxo.eg[[1]][sample(15),])),
 clabel.l = 1.25, clabel.n = 1.25, f = 0.75)
par(mfrow = c(1,1))
}
\keyword{manip}

\eof
\name{atlas}
\alias{atlas}
\docType{data}
\title{Small Ecological Dataset}
\description{
\code{atlas} is a list containing three kinds of information about 23 regions : \cr
geographical coordinates, meteorology and bird presences. 
}
\usage{data(atlas)}
\format{
 This list contains the following objects:
  \describe{
    \item{area}{is a convex hull of 23 geographical regions. }
    \item{xy}{are the coordinates of the region centers and altitude (in meters). }
    \item{names.district}{is a vector of region names.}
    \item{meteo}{is a data frame with 7 variables: min and max temperature in january; min and max temperature in july; january, july and total rainfalls.}
    \item{birds}{is a data frame with 15 variables (species).}
    \item{alti}{is a data frame with 3 variables altitude in percentage [0,800], ]800,1500] and ]1500,5000].}
    }
}
\source{
Extract from: \cr
Lebreton, Ph. (1977) Les oiseaux nicheurs rhonalpins. \emph{Atlas ornithologique Rhone-Alpes}.
Centre Ornithologique Rhone-Alpes, Université Lyon 1, 69621 Villeurbanne. 
Direction de la Protection de la Nature, Ministère de la Qualité de la Vie. 1--354.
}
\examples{
data(atlas)
op <- par(no.readonly = TRUE) 
par(mfrow = c(2,2))
area.plot(atlas$area, cpoin = 1.5)
area.plot(atlas$area, lab = atlas$names.district, clab = 1)
x <- atlas$meteo$mini.jan

names(x) <- row.names(atlas$meteo)
area.plot(atlas$area, val = x, ncl = 12, sub = "Temp Mini January", 
    csub = 2, cleg = 1)
s.corcircle((dudi.pca(atlas$meteo, scann = FALSE)$co), 
    clab = 1)

area.plot(atlas$area, val = dudi.pca(atlas$meteo,scann=FALSE)$li[,1], 
    ncl = 12, sub = "Principal Component Analysis analysis", csub = 1.5, 
    cleg = 1)
birds.coa <- dudi.coa(atlas$birds, sca = FALSE, nf = 1)
x <- birds.coa$li$Axis1
area.plot(atlas$area, val = x, ncl = 12, 
    sub = "Correspondence analysis", csub = 1.5, cleg = 1)

s.value(atlas$xy, x, contour = atlas$contour, csi = 2, 
    incl = FALSE, addax = FALSE)
triangle.plot(atlas$alti)
par(op)
par(mfrow=c(1,1))}
\keyword{datasets}

\eof
\name{atya}
\alias{atya}
\docType{data}
\title{Genetic variability of Cacadors}
\description{
This data set contains informations about genetic variability of \emph{Atya innocous} and \emph{Atya scabra} in Guadeloupe (France).
}
\usage{data(atya)}
\format{
\code{atya} is a list with the following objects : 
\describe{
   \item{xy}{: a data frame with the coordinates of the 31 sites}
   \item{gen}{: a data frame with 22 variables collected on 31 sites}
   \item{neig}{: an object of class \code{neig}}   
}}
\source{
Fievet, E., Eppe, F. and Dolédec, S. (2001) Etude de la variabilité morphométrique et génétique des populations de Cacadors (\emph{Atya innocous} et \emph{Atya scabra}) de l'île de Basse-Terre. Direction Régionale de L'Environnement Guadeloupe, Laboratoire des hydrosystèmes fluviaux, Université Lyon 1.
}
\examples{
\dontrun{
data(atya)
if (require(pixmap, quiet = TRUE)) {
    atya.digi <- read.pnm(system.file("pictures/atyadigi.pnm",
        package = "ade4"))
    atya.carto <- read.pnm(system.file("pictures/atyacarto.pnm",
        package = "ade4"))
    par(mfrow = c(1,2))
    plot(atya.digi)
    plot(atya.carto)
    points(atya$xy, pch = 20, cex = 2)
}
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
    plot(neig2nb(atya$neig), atya$xy, col = "red", add = TRUE, lwd = 2)
    par(mfrow = c(1,1))
}
}}
\keyword{datasets}

\eof
\name{avijons}
\alias{avijons}
\docType{data}
\title{Bird species distribution}
\description{
This data set contains informations about spatial distribution of bird species in a zone surrounding the river Rhône near Lyon (France).
}
\usage{data(avijons)}
\format{
\code{avijons} is a list with the following objects :
\describe{ 
   \item{xy}{: a data frame with the coordinates of the sites}
   \item{area}{: an object of class \code{area}}
   \item{fau}{: a data frame with the abundance of 64 bird species in 91 sites}
   \item{spe.names.fr}{: a vector of strings of character with the species names in french}
}}
\source{
Bournaud, M., Amoros, C., Chessel, D., Coulet, M., Doledec, S., Michelot, J.L., Pautou, G., Rostan, J.C., Tachet, H. and Thioulouse, J. (1990) 
\emph{Peuplements d'oiseaux et propriétés des écocomplexes de la plaine du Rhône : descripteurs de fonctionnement global et gestion des berges.} Rapport programme S.R.E.T.I.E., Ministère de l'Environnement CORA et URA CNRS 367, Univ. Lyon I. 
}
\references{
Thioulouse, J., Chessel, D. and Champely, S. (1995) Multivariate analysis of spatial patterns: a unified approach to local and global structures. \emph{Environmental and Ecological Statistics}, \bold{2}, 1--14.
}
\examples{
data(avijons)
w1=dudi.coa(avijons$fau,scannf=FALSE)$li
area.plot(avijons$area,center=avijons$xy,val=w1[,1],clab=0.75,sub="CA Axis 1",csub=3)
\dontrun{
data(avijons)
if (require(pixmap,quiet=TRUE)) {
    pnm.eau <- read.pnm(system.file("pictures/avijonseau.pnm",
        package = "ade4"))
    pnm.rou <- read.pnm(system.file("pictures/avijonsrou.pnm",
        package = "ade4"))
    pnm.veg <- read.pnm(system.file("pictures/avijonsveg.pnm",
        package = "ade4"))
    pnm.vil <- read.pnm(system.file("pictures/avijonsvil.pnm",
        package = "ade4"))
    jons.coa <- dudi.coa(avijons$fau, scan = FALSE, nf = 4)
    par(mfcol = c(3,2))
    s.value(avijons$xy, jons.coa$li[,1], pixmap = pnm.rou, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F1+ROADS", csub = 3)
    s.value(avijons$xy, jons.coa$li[,1], pixmap = pnm.veg, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F1+TREES", csub = 3)
    s.value(avijons$xy, jons.coa$li[,1], pixmap = pnm.eau, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F1+WATER", csub = 3)
    s.value(avijons$xy, jons.coa$li[,2], pixmap = pnm.rou, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F2+ROADS", csub = 3)
    s.value(avijons$xy, jons.coa$li[,2], pixmap = pnm.veg, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F2+TREES", csub = 3)
    s.value(avijons$xy, jons.coa$li[,2], pixmap = pnm.eau, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F2+WATER", csub = 3)
par(mfrow=c(1,1))}

if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE) 
        & require( pixmap, quiet = TRUE) ) {
    link1 <- area2link(avijons$area)
    lw1 <- apply(link1,1,function(x) x[x>0])
    neig1 <- neig(mat01=1*(link1>0))
    nb1 <- neig2nb(neig1)
    listw1 <- nb2listw(nb1,lw1)
    jons.ms <- multispati(jons.coa, listw1, scan = FALSE, nfp = 3,
     nfn = 2)
    summary(jons.ms)
    par(mfrow = c(2,2))
    barplot(jons.coa$eig)
    barplot(jons.ms$eig)
    s.corcircle(jons.ms$as)
    plot(jons.coa$li[,1], jons.ms$li[,1])

    par(mfcol=c(3,2))
    s.value(avijons$xy, jons.ms$li[,1], pixmap = pnm.rou, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F1+ROADS", csub = 3)
    s.value(avijons$xy, jons.ms$li[,1], pixmap = pnm.veg, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F1+TREES", csub = 3)
    s.value(avijons$xy, jons.ms$li[,1], pixmap = pnm.eau, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F1+WATER", csub = 3)
    s.value(avijons$xy, jons.ms$li[,2], pixmap = pnm.rou, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F2+ROADS", csub = 3)
    s.value(avijons$xy, jons.ms$li[,2], pixmap = pnm.veg, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F2+TREES", csub = 3)
    s.value(avijons$xy, jons.ms$li[,2], pixmap = pnm.eau, inclu = FALSE,
    grid = FALSE, addax = FALSE, cleg = 0, sub = "F2+WATER", csub = 3)
par(mfrow=c(1,1))
}}}
\keyword{datasets}

\eof
\name{avimedi}
\alias{avimedi}
\docType{data}
\title{Fauna Table for Constrained Ordinations}
\description{
\code{avimedi} is a list containing the informations about 302 sites : \cr
frequencies of 51 bird species ; two factors (habitats and Mediterranean origin). 
}
\usage{data(avimedi)}
\format{
  This list contains the following objects:
  \describe{
    \item{fau}{is a data frame 302 sites - 51 species. }
    \item{plan}{is a data frame 302 sites - 2 factors. }
    \item{nomesp}{is a vector 51 latin names. }
  }
}
\source{
Blondel, J., Chessel, D., & Frochot, B. (1988)
Bird species impoverishment, niche expansion, and density inflation in mediterranean island habitats.
\emph{Ecology}, \bold{69}, 1899--1917.
}
\examples{
\dontrun{
data(avimedi)
par(mfrow = c(2,2))
coa1 <- dudi.coa(avimedi$fau, scan = FALSE, nf = 3)
s.class(coa1$li,avimedi$plan$str:avimedi$plan$reg,
    sub = "Correspondences Analysis")
bet1 <- between(coa1, avimedi$plan$str, scan = FALSE)
s.class(bet1$ls, avimedi$plan$str,
    sub = "Between Analysis")
wit1 <- within(coa1, avimedi$plan$reg, scan=FALSE)
s.class(wit1$li, avimedi$plan$str,
    sub = "Within Analysis")
pcaiv1 <- pcaiv(coa1, avimedi$plan, scan = FALSE)
s.match(pcaiv1$li, pcaiv1$ls, clab = 0,
    sub = "Canonical Correspondences Analysis")
s.class(pcaiv1$li, avimedi$plan$str:avimedi$plan$reg, 
    add.plot = TRUE)
par(mfrow=c(1,1))
}}
\keyword{datasets}

\eof
\name{aviurba}
\alias{aviurba}
\docType{data}
\title{Ecological Tables Triplet}
\description{
This data set is a list of informations about 51 sites : species and environmental variables. \cr
For each species, a data frame contains biological traits. 
}
\usage{data(aviurba)}
\format{
    This list contains the following objects:
    \describe{
        \item{fau}{is a data frame 51 sites 40 species. }
        \item{mil}{is a data frame 51 sites 11 environmental variables. }
        \item{traits}{is a data frame 40 species 4 biological traits.}
        \item{species.names.fr}{is a vector of the species names in french. }
        \item{species.names.la}{is a vector of the species names in latin. }
        \item{species.family}{is a factor : the species families. }
    }
}
\source{
Dolédec, S., Chessel, D., Ter Braak,C. J. F.  and Champely S. (1996)
Matching species traits to environmental variables: a new three-table ordination method.
\emph{Environmental and Ecological Statistics}, \bold{3}, 143--166.
}
\examples{
data(aviurba)
a1 <- dudi.coa(aviurba$fau, scan = FALSE, nf=4)
a2 <- dudi.acm(aviurba$mil, row.w = a1$lw, scan = FALSE, nf = 4)
plot(coinertia(a1, a2, scan = FALSE))
}
\keyword{datasets}

\eof
\name{bacteria}
\alias{bacteria}
\docType{data}
\title{Genomes of 43 Bacteria}
\description{
    \code{bacteria} is a list containing 43 species and genomic informations : codons, amino acid and bases. 
}
\usage{data(bacteria)}
\format{
    This list contains the following objects:
    \describe{
        \item{code}{is a factor with the amino acid names for each codon. }
        \item{espcodon}{is a data frame 43 species 64 codons. }
        \item{espaa}{is a data frame 43 species 21 amino acid. }
        \item{espbase}{is a data frame 43 species 4 bases. }
    }
}
\source{
Data prepared by J. Lobry \email{lobry@biomserv.univ-lyon1.fr}
starting from:\cr
\url{http://www.tigr.org/tdb/mdb/mdbcomplete.html}
}
\examples{
data(bacteria)
names(bacteria$espcodon)
names(bacteria$espaa)
names(bacteria$espbase)
sum(bacteria$espcodon) # 22,619,749 codons
scatter.coa(dudi.coa(bacteria$espcodon, scann = FALSE), 
    posi = "bottom")
}
\keyword{datasets}

\eof
\name{banque}
\alias{banque}
\docType{data}
\title{Table of Factors}
\description{
\code{banque} gives the results of a bank survey onto 810 customers. 
}
\usage{data(banque)}
\format{
  This data frame contains the following columns:
  \enumerate{
    \item{csp}{: "Socio-professional categories" a factor with levels 
        \code{agric} Farmers 
        \code{artis} Craftsmen, Shopkeepers, Company directors 
        \code{cadsu} Executives and higher intellectual professions 
        \code{inter} Intermediate professions 
        \code{emplo} Other white-collar workers 
        \code{ouvri} Manual workers 
        \code{retra} Pensionners 
        \code{inact} Non working population 
        \code{etudi} Students} 

    \item{duree}{: "Time relations with the customer" a factor with levels 
        \code{dm2} <2 years 
        \code{d24} [2 years, 4 years[ 
        \code{d48} [4 years, 8 years[ 
        \code{d812} [8 years, 12 years[ 
        \code{dp12} >= 12 years}
    
    \item{oppo}{: "Stopped a check ?" a factor with levels 
        \code{non} no 
        \code{oui} yes}
    
    \item{age}{: "Customer's age" a factor with levels 
        \code{ai25} [18 years, 25 years[ 
        \code{ai35} [25 years, 35 years[
        \code{ai45} [35 years, 45 years[ 
        \code{ai55} [45 years, 55 years[ 
        \code{ai75} [55 years, 75 years[}
    
    \item{sexe}{: "Customer's gender" a factor with levels 
        \code{hom} Male 
        \code{fem} Female}
    
    \item{interdit}{: "No checkbook allowed" a factor with levels
        \code{non} no 
        \code{oui} yes }
    
    \item{cableue}{: "Possess a bank card ?" a factor with levels 
        \code{non} no 
        \code{oui} yes }
    
    \item{assurvi}{: "Contrat of life insurance ?" a factor with levels 
        \code{non} no\cr
        \code{oui} yes}
    
    \item{soldevu}{: "Balance of the current accounts" a factor with levels 
        \code{p4} credit balance > 20000 
        \code{p3} credit balance 12000-20000 
        \code{p2} credit balance 4000-120000 
        \code{p1} credit balance >0-4000 
        \code{n1} debit balance  0-4000 
        \code{n2} debit balance >4000  }
    
    \item{eparlog}{: "Savings and loan association account amount" a factor with levels 
        \code{for} > 20000 
        \code{fai} >0 et <20000 
        \code{nul} nulle  }
    
    \item{eparliv}{: "Savings bank amount" a factor with levels 
        \code{for} > 20000 
        \code{fai} >0 et <20000 
        \code{nul} nulle  }
    
    \item{credhab}{: "Home loan owner" a factor with levels 
        \code{non} no 
        \code{oui} yes  }
    
    \item{credcon}{: "Consumer credit amount" a factor with levels 
        \code{nul} none 
        \code{fai} >0 and <20000 
        \code{for} > 20000  }
    
    \item{versesp}{: "Check deposits" a factor with levels 
        \code{oui} yes 
        \code{non} no  }
    
    \item{retresp}{: "Cash withdrawals" a factor with levels 
        \code{fai} < 2000 
        \code{moy} 2000-5000 
        \code{for} > 5000  }
    
    \item{remiche}{: "Endorsed checks amount" a factor with levels 
        \code{for} >10000 
        \code{moy} 10000-5000 
        \code{fai} 1-5000 
        \code{nul} none  }
    
    \item{preltre}{: "Treasury Department tax deductions" a factor with levels 
        \code{nul} none 
        \code{fai} <1000 
        \code{moy} >1000  }
    
    \item{prelfin}{: "Financial institution deductions" a factor with levels 
        \code{nul} none 
        \code{fai} <1000 
        \code{moy} >1000  }
    
    \item{viredeb}{: "Debit transfer amount" a factor with levels 
        \code{nul} none 
        \code{fai} <2500 
        \code{moy} 2500-5000 
        \code{for} >5000  }
    
    \item{virecre}{: "Credit transfer amount" a factor with levels 
        \code{for} >10000 
        \code{moy} 10000-5000 
        \code{fai} <5000 
        \code{nul} aucun  }
    
    \item{porttit}{: "Securities portfolio estimations" a factor with levels 
        \code{nul} none 
        \code{fai} < 20000 
        \code{moy} 20000-100000 
        \code{for} >100000  }
  }
}
\source{
 anonymous
}
\examples{
data(banque)
banque.acm <- dudi.acm(banque, scann = FALSE, nf = 3)
apply(banque.acm$cr, 2, mean)
banque.acm$eig[1:banque.acm$nf] # the same thing
s.arrow(banque.acm$c1, clab = 0.75)
}
\keyword{datasets}

\eof
\name{baran95}
\alias{baran95}
\docType{data}
\title{African Estuary Fishes}
\description{
This data set is a list containing relations between sites and species linked to dates.
}
\usage{data(baran95)}
\format{
    This list contains the following objects:
    \describe{
        \item{fau}{is a data frame 95 sites 33 species. }
        \item{plan}{is a data frame 2 factors date and site. }
        \item{species.names}{is a vector of species latin names. }
    }
}
\source{
Baran, E. (1995) \emph{Dynamique spatio-temporelle des peuplements de Poissons estuariens en Guinée (Afrique de l'Ouest)}.
Thèse de Doctorat, Université de Bretagne Occidentale. 
Data collected by net fishing sampling in the Fatala river estuary.
}
\examples{
data(baran95)
w <- dudi.pca(log(baran95$fau+1), scal = FALSE, scann = FALSE, 
    nf = 3)
w1 <- within(w, baran95$plan$date, scann = FALSE)
fatala <- ktab.within(w1)
stat1 <- statis(fatala, scan = FALSE, nf = 3)
w1 <- split(stat1$C.Co, baran95$plan$date)
w2 <- split(baran95$plan$site, baran95$plan$date)
par(mfrow = c(3,2))
for (j in 1:6) {
    s.label(stat1$C.Co[,1:2], clab = 0,
    sub = tab.names(fatala)[j], csub = 3)
    s.class(w1[[j]][,1:2], w2[[j]], clab = 2, axese = FALSE,
    add.plot = TRUE)
}
par(mfrow = c(1,1))

kplot(stat1, arrow = FALSE, traj = FALSE, clab = 2, uni = TRUE, 
    class = baran95$plan$site) #simpler

mfa1 <- mfa(fatala, scan = FALSE, nf = 3)
w1 <- split(mfa1$co, baran95$plan$date)
w2 <- split(baran95$plan$site, baran95$plan$date)
par(mfrow = c(3,2))
for (j in 1:6) {
    s.label(mfa1$co[,1:2], clab = 0,
    sub = tab.names(fatala)[j], csub = 3)
    s.class(w1[[j]][,1:2], w2[[j]], clab = 2, axese=FALSE,
    add.plot = TRUE)
}
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{between}
\alias{between}
\alias{print.between}
\alias{plot.between}
\title{Between-Class Analysis}
\description{
Performs a particular case of a Principal Component Analysis with respect to Instrumental Variables,
in which there is only one instrumental variable, and it is a factor.
}
\usage{
between(dudi, fac, scannf = TRUE, nf = 2)
plot.between(x, xax = 1, yax = 2, \dots) 
print.between(x, \dots) 
}
\arguments{
  \item{dudi}{a duality diagram, object of class \code{\link{dudi}} from one of the functions dudi.coa, dudi.pca, ...}
  \item{fac}{a factor partitioning the rows of \code{dudi$tab} in classes}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, a numeric value indicating the number of kept axes}
  \cr
  \item{x}{an object of class 'between'}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
Returns a list of subclass 'between' of class 'dudi' (see \code{\link{dudi}})
  \item{tab}{a data frame class-variables, array of variables means in each class}
  \item{cw}{a numeric vector of the column weigths}
  \item{lw}{a numeric vector of the group weigths}
  \item{eig}{a numeric vector with all the eigenvalues}
  \item{rank}{an integer}
  \item{nf}{an integer value indicating the number of kept axes}
  \item{c1}{a data frame with the column normed scores}
  \item{l1}{a data frame with the class normed scores}
  \item{co}{a data frame  with the column coordinates}
  \item{li}{a data frame with the class coordinates}
  \item{call}{the origin}
  \item{ratio}{the bewteen-class inertia percentage}
  \item{ls}{a data frame with the row coordinates}
  \item{as}{a data frame containing the projection of inertia axes onto between axes}
}
\references{
Dolédec, S. and Chessel, D. (1987) Rythmes saisonniers et composantes stationnelles en milieu aquatique
I- Description d'un plan d'observations complet par projection de variables. \emph{Acta Oecologica, Oecologia Generalis}, \bold{8}, 3, 403--426.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(meaudret)
par(mfrow = c(2,2))
pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 4)
s.class(pca1$li, meaudret$plan$sta,
    sub = "Principal Component Analysis (mil)", csub = 1.75)
pca2 <- dudi.pca(meaudret$fau, scal = FALSE, scan = FALSE, nf = 4)
s.class(pca2$li, meaudret$pla$sta,
    sub = "Principal Component Analysis (fau)", csub = 1.75)
bet1 <- between(pca1, meaudret$plan$sta, scan = FALSE, nf = 2)
bet2 <- between(pca2, meaudret$plan$sta, scan = FALSE, nf = 2)
s.class(bet1$ls, meaudret$plan$sta,
    sub = "Between sites PCA (mil)", csub = 1.75)
s.class(bet2$ls, meaudret$plan$sta,
    sub = "Between sites PCA (fau)", csub = 1.75)

par(mfrow = c(1,1))
coib <- coinertia(bet1, bet2, scann = FALSE)
plot(coib)
}
\keyword{multivariate}

\eof
\name{bf88}
\alias{bf88}
\docType{data}
\title{Cubic Ecological Data}
\description{
\code{bf88} is a list of 6 data frames corresponding to 6 stages of vegetation. \cr
Each data frame gives some bird species informations for 4 counties. 
}
\usage{data(bf88)}
\format{
A list of six data frames with 79 rows (bird species) and 4 columns (counties).\cr
The 6 arrays (S1 to S6) are the 6 stages of vegetation.\cr
The attribut 'nomesp' of this list is a vector of species french names. 
}
\source{
Blondel, J. and Farre, H. (1988) 
The convergent trajectories of bird communities along ecological successions in european forests. 
\emph{Oecologia} (Berlin), \bold{75}, 83--93.
}
\examples{
data(bf88)
fou1 <- foucart(bf88, scann = FALSE, nf = 3)
fou1
par(mfrow = c(2,2))
scatter(fou1)
s.traject(fou1$Tco, fou1$TC[,1])
s.traject(fou1$Tco, fou1$TC[,2])
s.label(fou1$Tco)
s.label(fou1$co, add.p = TRUE, clab = 2)
par(mfrow = c(1,1))
kplot(fou1, clab.c = 2, clab.r = 0, csub = 3)
}
\keyword{datasets}

\eof
\name{bicenter.wt}
\alias{bicenter.wt}
\title{Double Weighted Centring}
\description{
This function creates a doubly centred matrix. 
}
\usage{
bicenter.wt(X, row.wt = rep(1, nrow(X)), col.wt = rep(1, ncol(X)))
}
\arguments{
  \item{X}{a matrix with n rows and p columns}
  \item{row.wt}{a vector of positive or null weights of length n}
  \item{col.wt}{a vector of positive or null weights of length p}
}
\value{
returns a doubly centred matrix
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
w <- matrix(1:6, 3, 2)
bicenter.wt(w, c(0.2,0.6,0.2), c(0.3,0.7))

w <- matrix(1:20, 5, 4)
sum(bicenter.wt(w, runif(5), runif(4))^2)
}
\keyword{utilities}

\eof
\name{bordeaux}
\alias{bordeaux}
\docType{data}
\title{Wine Tasting}
\description{
The \code{bordeaux} data frame gives the opinions of 200 judges in a blind tasting of five different types of claret 
(red wine from the Bordeaux area in the south western parts of France).
}
\usage{data(bordeaux)}
\format{
  This data frame has 5 rows (the wines) and 4 columns (the judgements) divided in excellent,
  good, mediocre and boring.
  }
}
\source{
 van Rijckevorsel, J. (1987) \emph{The application of fuzzy coding and horseshoes in multiple correspondence analysis}.
 DSWO Press, Leiden (p. 32)
}
\examples{
data(bordeaux)
bordeaux
score(dudi.coa(bordeaux, scan = FALSE))
}
\keyword{datasets}

\eof
\name{bsetal97}
\alias{bsetal97}
\docType{data}
\title{Ecological and Biological Traits}
\description{
This data set gives ecological and biological characteristics of 131 species of aquatic insects. 
}
\usage{data(bsetal97)}
\format{
'bsetal97' is a list of 8 components.\cr
    \describe{
    \item{species.names}{is a vector of the species names.}
    \item{taxo}{is a data frame containing the taxonomy of species. }
    \item{biol}{is a data frame containing the biological traits. }
    \item{biol.blo}{is a vector of the numbers of items for each biological trait. }
    \item{biol.blo.names}{is a vector of the names of the biological traits. }
    \item{ecol}{is a data frame with the ecological traits. }
    \item{ecol.blo}{is a vector of the numbers of items for each ecological trait. }
    \item{ecol.blo.names}{is a vector of the names of the ecological traits. }
    }
}
\source{
 Statzner, B., Hoppenhaus, K., Arens, M.-F. and Richoux, P. (1997) 
 Reproductive traits, habitat use and templet theory: a synthesis of world-wide data on aquatic insects.
 \emph{Freshwater Biology}, \bold{38}, 109--135.
}
\examples{
data(bsetal97)
X <- prep.fuzzy.var(bsetal97$biol, bsetal97$biol.blo)
Y <- prep.fuzzy.var(bsetal97$ecol, bsetal97$ecol.blo)
plot(coinertia(dudi.fca(X, scan = FALSE), 
    dudi.fca(Y, scan = FALSE), scan = FALSE))
}
\keyword{datasets}

\eof
\name{buech}
\alias{buech}
\docType{data}
\title{Buech basin}
\description{
This data set contains informations about Buech basin characteristics.
}
\usage{data(buech)}
\format{
\code{buech} is a list with the following components : 
\describe{
   \item{tab1}{: a data frame with 10 environmental variables collected on 31 sites in Juin (1984)}
   \item{tab2}{: a data frame with 10 environmental variables collected on 31 sites in September (1984)}
   \item{xy}{: a data frame with the coordinates of the sites}
   \item{neig}{: an object of class \code{neig}}
   \item{contour}{: a data frame for background map}}
}
\details{
Variables of \code{buech$tab1} and \code{buech$tab2} are the following ones :\cr 
pH ; Conductivity (µS/cm) ; Carbonate (water hardness (mg/l CaCO3)) ;
hardness (total water hardness (mg/l CaCO3)) ; Bicarbonate (alcalinity (mg/l HCO3-)) ;
Chloride (alcalinity (mg/l Cl-)) ; Suspens (particles in suspension (mg/l)) ;
Organic (organic particles (mg/l)) ; Nitrate (nitrate rate (mg/l NO3-)) ;
Ammonia (amoniac rate (mg/l NH4-))
}
\source{
Vespini, F. (1985) \emph{Contribution à l'étude hydrobiologique du Buech, rivière non aménagée de Haute-Provence}. Thèse de troisième cycle, Université de Provence.

Vespini, F., Légier, P. and Champeau, A. (1987) Ecologie d'une rivière non aménagée des Alpes du Sud : Le Buëch (France) I. Evolution longitudinale des descripteurs physiques et chimiques. \emph{Annales de Limnologie}, \bold{23}, 151--164.
}
\examples{
data(buech)
par(mfrow = c(1,2))
s.label(buech$xy, contour = buech$contour, neig = buech$neig)
s.value (buech$xy, buech$tab2$Suspens-buech$tab1$Suspens,
     contour = buech$contour, neig = buech$neig, csi = 3)
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{butterfly}
\alias{butterfly}
\docType{data}
\title{Genetics-Ecology-Environment Triple}
\description{
This data set contains environmental and genetics informations about 16 Euphydryas editha butterfly colonies studied in California and Oregon.
}
\usage{data(butterfly)}
\format{
\code{butterfly} is a list with 4 components.
\describe{
    \item{xy}{is a data frame with the two coordinates of the 16 Euphydryas editha butterfly colonies. }
    \item{envir}{is a environmental data frame of  16 sites - 4 variables. }
    \item{genet}{is a genetics data frame of 16 sites - 6 allele frequencies. }
    \item{contour}{is a data frame for background map (California map). }
    }
}
\source{
McKechnie, S.W., Ehrlich, P.R. and White, R.R. (1975) 
Population genetics of Euphydryas butterflies. 
I. Genetic variation and the neutrality hypothesis. 
\emph{Genetics}, \bold{81}, 571--594.

Manly, B.F. (1994) \emph{Multivariate Statistical Methods. A primer.}
Second edition. Chapman & Hall, London. 1--215.
}
\examples{
library(mva)
data(butterfly)
par(mfrow = c(2,2))
s.label(butterfly$xy, contour = butterfly$contour, inc = FALSE)
table.dist(dist(butterfly$xy), labels = row.names(butterfly$xy)) # depends of mva
s.value(butterfly$xy, dudi.pca(butterfly$envir, scan = FALSE)$li[,1], 
    contour = butterfly$contour, inc = FALSE, csi = 3)
plot(mantel.randtest(dist(butterfly$xy), dist(butterfly$gen), 99),
    main = "genetic/spatial")
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{cailliez}
\alias{cailliez}
\title{Transformation to make Euclidean a distance matrix}
\description{
This function computes the smallest positive constant that makes Euclidean a distance matrix
and applies it. 
}
\usage{
cailliez(distmat, print = FALSE)
}
\arguments{
  \item{distmat}{an object of class \code{dist}}
  \item{print}{if TRUE, prints the eigenvalues of the matrix}
}
\value{
an object of class \code{dist} containing a Euclidean distance matrix.
}
\references{
Cailliez, F. (1983) The analytical solution of the additive constant problem. \emph{Psychometrika}, \bold{48}, 305--310.\cr

Legendre, P. and Anderson, M.J. (1999) Distance-based redundancy analysis: testing multispecies responses in multifactorial ecological experiments. \emph{Ecological Monographs}, \bold{69}, 1--24.\cr

Legendre, P., and Legendre, L. (1998) \emph{Numerical ecology}, 2nd English edition edition. Elsevier Science BV, Amsterdam.\cr

From the DistPCoa program of P. Legendre et M.J. Anderson\cr
\url{http://www.fas.umontreal.ca/BIOL/Casgrain/en/labo/distpcoa.html}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
library(mva)
data(capitales)
d0 <- as.dist(capitales$df)
is.euclid(d0) # FALSE
d1 <- cailliez(d0, TRUE)
# Cailliez constant = 2429.87867 
is.euclid(d1) # TRUE
plot(d0, d1)
abline(lm(unclass(d1)~unclass(d0)))
print(coefficients(lm(unclass(d1)~unclass(d0))), dig = 8) # d1 = d + Cte
is.euclid(d0 + 2428) # FALSE
is.euclid(d0 + 2430) # TRUE the smallest constant
}
\keyword{array}

\eof
\name{capitales}
\alias{capitales}
\docType{data}
\title{Road Distances}
\description{
This data set gives the road distances between 15 european capitals and their coordinates. 
}
\usage{data(capitales)}
\format{
This list contains the following objects:
    \describe{
    \item{df}{is a data frame containing the road distances between 15 european capitals. }
    \item{xy}{is a data frame containing the coordinates of capitals. }
    }
}
\source{
 \url{http://www.euro.gouv.fr/jeunes/eurocollege/tableaucarte.htm}
}
\examples{
if (require(pixmap, quiet = TRUE)) {
    library(mva)
    data(capitales)
    names(capitales$df)
    # [1] "Madrid"     "Paris"      "Londres"    "Dublin"     "Rome"      
    # [6] "Bruxelles"  "Amsterdam"  "Berlin"     "Copenhague" "Stokholm"  
    #[11] "Luxembourg" "Helsinki"   "Vienne"     "Athenes"    "Lisbonne"

    capitales.pnm <- read.pnm(system.file("pictures/capitales.pnm", package = "ade4"))
    # plot(capitales.pnm) # depends of pixmap
    # xy <- locator(15) # funny
    data(capitales)
    par(mfrow = c(2,2))
    s.label(capitales$xy, lab = names(capitales$df)) 
    s.label(capitales$xy, lab = names(capitales$df), pixmap = capitales.pnm, inc = FALSE)
    table.dist(as.dist(capitales$df), lab = names(capitales$df)) # depends of mva
    s.label(pcoscaled(lingoes(as.dist(capitales$df))))
    par(mfrow = c(1,1))
}
}
\keyword{datasets}

\eof
\name{carni19}
\alias{carni19}
\docType{data}
\title{Phylogeny and quantative trait of carnivora}
\description{
This data set describes the phylogeny of carnivora as reported by Diniz-Filho et al. (1998). It also gives the body mass of these 19 species.
}
\usage{data(carni19)}
\format{
\code{carni19} is a list containing the 2 following objects : 
\describe{     
   \item{tre}{is a character string giving the phylogenetic tree in Newick format.} 
   \item{bm}{is a numeric vector which values correspond to the body mass of the 19 species (log scale).}
}}
\source{
Diniz-Filho, J. A. F., de Sant'Ana, C.E.R. and Bini, L.M. (1998) 
An eigenvector method for estimating phylogenetic inertia. \emph{Evolution}, \bold{52}, 1247--1262.
}
\examples{
data(carni19)
carni19.phy <- newick2phylog(carni19$tre)
par(mfrow = c(1,2))
symbols.phylog(carni19.phy,carni19$bm-mean(carni19$bm))
dotchart.phylog(carni19.phy, carni19$bm, clabel.l=0.75)
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{carni70}
\alias{carni70}
\docType{data}
\title{Phylogeny and quantitative traits of carnivora}
\description{
This data set describes the phylogeny of 70 carnivora as reported by Diniz-Filho and Torres (2002). It also gives the geographic range size and body size corresponding to these 70 species.
}
\usage{data(carni70)}
\format{
\code{carni70} is a list containing the 2 following objects : 
\describe{
   \item{tre}{is a character string giving the phylogenetic tree in Newick format.} 
   \item{tab}{is a data frame with 70 species and two traits : size (body size (kg)) ; range (geographic range size (km)).}    
}}
\source{
Diniz-Filho, J. A. F., and N. M. Tôrres. (2002) Phylogenetic comparative methods and the 
geographic range size-body size relationship in new world terrestrial carnivora. \emph{Evolutionary Ecology}, \bold{16}, 351--367.
}
\examples{
\dontrun{
data(carni70)
carni70.phy <- newick2phylog(carni70$tre)
plot.phylog(carni70.phy)

size <- scalewt(log(carni70$tab))[,1]
names(size) <- row.names(carni70$tab)
symbols.phylog(carni70.phy,size)
orthogram(size, phylog = carni70.phy)

yrange <- scalewt(carni70$tab[,2])
names(yrange) <- row.names(carni70$tab)
symbols.phylog(carni70.phy,yrange)
orthogram(yrange, phylog = carni70.phy)

s.hist(cbind.data.frame(size, yrange), clabel = 0)
}}
\keyword{datasets}

\eof
\name{carniherbi49}
\alias{carniherbi49}
\docType{data}
\title{Taxonomy, phylogenies and quantitative traits of carnivora and herbivora}
\description{
This data set describes the taxonomic and phylogenetic relationships of 49 carnivora and herbivora species as reported by Garland and Janis (1993) and Garland et al. (1993). It also gives seven traits corresponding to these 49 species.
}
\usage{data(carniherbi49)}
\format{
\code{carniherbi49} is a list containing the 5 following objects : 
\describe{
   \item{taxo}{is a data frame with 49 species and 2 columns : 'fam', a factor family with 14 levels  
   and 'ord', a factor order with 3 levels.}
   \item{tre1}{is a character string giving the phylogenetic tree in Newick format as reported by Garland et al. (1993).}      
   \item{tre2}{is a character string giving the phylogenetic tree in Newick format as reported by Garland and Janis (1993).}      
   \item{tab1}{is a data frame with 49 species and 2 traits: 'bodymass' (body mass (kg)) and 'homerange' (home range (km)).}  
   \item{tab2}{is a data frame with 49 species and 5 traits: 'clade' (dietary with two levels \code{Carnivore} 
   and \code{Herbivore}), 'runningspeed' (maximal sprint running speed (km/h)), 'bodymass' (body mass (kg)),
   'hindlength' (hind limb length (cm)) and 'mtfratio' (metatarsal/femur ratio).}  
}}
\source{
Garland, T., Dickerman, A. W., Janis, C. M. and Jones, J. A. (1993) Phylogenetic analysis of covariance by computer simulation. 
\emph{Systematics Biology}, \bold{42}, 265--292. 

Garland, T. J. and Janis, C.M. (1993) Does metatarsal-femur ratio predict maximal running speed in cursorial mammals? 
\emph{Journal of  Zoology}, \bold{229}, 133--151.
}
\examples{
\dontrun{
data(carniherbi49)
par(mfrow=c(1,3))
plot(newick2phylog(carniherbi49$tre1), clabel.leaves = 0,
 f.phylog = 2, sub ="article 1")
plot(newick2phylog(carniherbi49$tre2), clabel.leaves = 0,
 f.phylog = 2, sub = "article 2")
taxo <- as.taxo(carniherbi49$taxo)
plot(taxo2phylog(taxo), clabel.nodes = 1.2, clabel.leaves = 1.2)
par(mfrow = c(1,1))
}}
\keyword{datasets}

\eof
\name{casitas}
\docType{data}
\alias{casitas}
\title{Enzymatic polymorphism in Mus musculus}
\description{
  This data set is a data frame with 74 rows (mice) and 15 columns (loci enzymatic polymorphism of the DNA mitochondrial). Each value contains 6 characters coding for two allelles. The missing values are coding by '000000'.
} 
\usage{data(casitas)} 
\format{
The 74 individuals of  \code{casitas} belong to 4 groups:
  \describe{
    \item{1}{24 mice of the sub-species \emph{Mus musculus domesticus}}
    \item{2}{11 mice of the sub-species \emph{Mus musculus castaneus}}
    \item{3}{9 mice of the sub-species \emph{Mus musculus musculus}}
    \item{4}{30 mice from a population of the lake Casitas (California)}
  }
} 
\source{
Exemple du logiciel GENETIX.\cr
Belkhir k. et al. GENETIX, logiciel sous WindowsTM pour la génétique des populations. 
Laboratoire Génome, Populations, Interactions CNRS UMR 5000, Université de Montpellier II, Montpellier (France).
\url{http://www.univ-montp2.fr/~genetix/genetix/genetix.htm}
}
\references{
Orth, A., T. Adama, W. Din and F. Bonhomme. (1998) Hybridation naturelle entre deux sous espèces de souris domestique 
\emph{Mus musculus domesticus} et \emph{Mus musculus castaneus} près de Lake Casitas (Californie). \emph{Genome}, \bold{41}, 104--110.
}
\examples{
data(casitas)
casitas.pop <- as.factor(rep(c("dome", "cast", "musc", "casi"), c(24,11,9,30)))
table(casitas.pop,casitas[,1]) 
casi.genet <- char2genet(casitas, casitas.pop)
names(casi.genet)
} 
\keyword{datasets}

\eof
\name{cca}
\alias{cca}
\title{Canonical Correspondence Analysis}
\description{
Performs a Canonical Correspondence Analysis.  
}
\usage{
cca(sitspe, sitenv, scannf = TRUE, nf = 2)
}
\arguments{
  \item{sitspe}{a data frame for correspondence analysis, typically a sites x species table}
  \item{sitenv}{a data frame containing variables, typically a sites x environmental variables table}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
returns an object of class \code{pcaiv}. See \code{\link{pcaiv}}
}
\references{
Ter Braak, C. J. F. (1986) Canonical correspondence analysis : a new eigenvector technique for multivariate direct gradient analysis. \emph{Ecology}, \bold{67}, 1167--1179.\cr

Ter Braak, C. J. F. (1987) The analysis of vegetation-environment relationships by canonical correspondence analysis. \emph{Vegetatio}, \bold{69}, 69--77.\cr

Chessel, D., Lebreton J. D. and Yoccoz N. (1987) Propriétés de l'analyse canonique des correspondances. Une utilisation en hydrobiologie. \emph{Revue de Statistique Appliquée}, \bold{35}, 55--72.\cr
}
\seealso{\code{\link{cca}} in the package \code{vegan}}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(rpjdl)
millog <- log(rpjdl$mil + 1)
iv1 <- cca(rpjdl$fau, millog, scan = FALSE)
plot(iv1)

# analysis with c1 - as - li -ls
# projections of inertia axes on PCAIV axes
s.corcircle(iv1$as)

# Species positions
s.label(iv1$c1, 2, 1, clab = 0.5, xlim = c(-4,4))
# Sites positions at the weighted mean of present species
s.label(iv1$ls, 2, 1, clab = 0, cpoi = 1, add.p = TRUE)

# Prediction of the positions by regression on environmental variables
s.match(iv1$ls, iv1$li, 2, 1, clab = 0.5)

# analysis with fa - l1 - co -cor
# canonical weights giving unit variance combinations
s.arrow(iv1$fa)

# sites position by environmental variables combinations
# position of species by averaging
s.label(iv1$l1, 2, 1, clab = 0, cpoi = 1.5)
s.label(iv1$co, 2, 1, add.plot = TRUE)

s.distri(iv1$l1, rpjdl$fau, 2, 1, cell = 0, csta = 0.33)
s.label(iv1$co, 2, 1, clab = 0.75, add.plot = TRUE)

# coherence between weights and correlations
par(mfrow = c(1,2))
s.corcircle(iv1$cor, 2, 1)
s.arrow(iv1$fa, 2, 1)
par(mfrow = c(1,1))
 }
\keyword{multivariate}

\eof
\name{chatcat}
\alias{chatcat}
\docType{data}
\title{Qualitative Weighted Variables}
\description{
  This data set gives the age, the fecundity and the number of litters for 26 groups of cats. 
}
\usage{data(chatcat)}
\format{
\code{chatcat} is a list of two objects :
    \describe{
    \item{tab}{is a data frame with 3 factors (age, feco, nport). }
    \item{eff}{is a vector of numbers. }
    }
}
\details{
One row of \code{tab} corresponds to one group of cats.\cr
The value in \code{eff} is the number of cats in this group.
}
\source{
Pontier, D. (1984)
\emph{Contribution à la biologie et à la génétique des populations de chats domestiques (Felis catus).}
Thèse de 3ème cycle. Université Lyon 1, p. 67.
}
\examples{
data(chatcat)
summary(chatcat$tab)
w <- acm.disjonctif(chatcat$tab) #  Disjonctive table
names(w) <- c(paste("A", 1:5, sep = ""), paste("B", 1:5, sep = ""), 
    paste("C", 1:2, sep = ""))
w <- t(w*chatcat$num)%*%as.matrix(w)
w <- data.frame(w)
w # BURT table
}
\keyword{datasets}

\eof
\name{chats}
\alias{chats}
\docType{data}
\title{Pair of Variables}
\description{
This data set is a contingency table of age classes and fecundity classes of cats felis catus. 
}
\usage{data(chats)}
\format{
    \code{chats} is a data frame with 8 rows and 8 columns.\
    The 8 rows are age classes (age1, \dots, age8)\
    The 8 columns are fecundity classes (f0, f12, f34, \dots, fcd)\
    The values are cats numbers (contingency table).
}
\source{
Legay, J.M. and Pontier, D. (1985)
Relation âge-fécondité dans les populations de Chats domestiques, Felis catus.
\emph{Mammalia}, \bold{49}, 395--402.
}
\examples{
data(chats)
chatsw <- data.frame(t(chats))
chatscoa <- dudi.coa(chatsw, scann = FALSE)
par(mfrow = c(2,2))
table.cont(chatsw, abmean.x = TRUE, csi = 2, abline.x = TRUE, 
    clabel.r = 1.5, clabel.c = 1.5)
table.cont(chatsw, abmean.y = TRUE, csi = 2, abline.y = TRUE, 
    clabel.r = 1.5, clabel.c = 1.5)
table.cont(chatsw, x = chatscoa$c1[,1], y = chatscoa$l1[,1],
    abmean.x = TRUE, csi = 2, abline.x = TRUE, clabel.r = 1.5, 
    clabel.c = 1.5)
table.cont(chatsw,, x = chatscoa$c1[,1], y = chatscoa$l1[,1],
    abmean.y = TRUE, csi = 2, abline.y = TRUE, clabel.r = 1.5, 
    clabel.c = 1.5)
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{chazeb}
\alias{chazeb}
\docType{data}
\title{Charolais-Zebus}
\description{
This data set gives six different weights of 23 charolais and zebu oxen. 
}
\usage{data(chazeb)}
\format{
  \code{chazeb} is a list of 2 components.
  \describe{
      \item{tab}{is a data frame with 23 rows and 6 columns.}
      \item{cla}{is a factor with two levels "cha" et "zeb". }
  }
}
\source{
Tomassone, R., Danzard, M., Daudin, J. J. and Masson J. P.  (1988) 
\emph{Discrimination et classement}, Masson, Paris. p. 43
}
\examples{
data(chazeb)
plot(discrimin(dudi.pca(chazeb$tab, scan = FALSE), 
    chazeb$cla, scan = FALSE))
}
\keyword{datasets}

\eof
\name{chevaine}
\docType{data}
\alias{chevaine}
\title{Enzymatic polymorphism in Leuciscus cephalus}
\description{
  This data set contains a list of two components: a spatial map and allellic profiles.
} 
\usage{data(chevaine)} 
\format{
This data set is a list of two components:
  \describe{
    \item{tab}{ a data frame with 27 populations and 9 allellic profiles}
    \item{coo}{ a list containing all the elements to build a spatial map}
  }
} 
\source{
Exemple du logiciel GENETIX.\cr
Belkhir k. et al. GENETIX, logiciel sous WindowsTM pour la génétique des populations. 
Laboratoire Génome, Populations, Interactions CNRS UMR 5000, Université de Montpellier II, Montpellier (France).
\url{http://www.univ-montp2.fr/~genetix/genetix/genetix.htm}
}
\references{
Guinand B., Bouvet Y. and Brohon B. (1996) Spatial aspects of genetic differentiation of the European chub in the Rhone River basin. \emph{Journal of Fish Biology}, \bold{49}, 714--726.
}
\examples{
data(chevaine)
'fun.chevaine' <- function(label=TRUE) {
    opar <- par(mar = par("mar"))
        on.exit(par(opar))
        par(mar = c(0.1, 0.1, 0.1, 0.1))
    s.label(chevaine$coo$poi, xlim = c(-20,400), clab = 0, cpoi = 0)
    invisible(lapply(chevaine$coo$lac, polygon,col = "blue", type = "l", lwd = 2)) 
    invisible(lapply(chevaine$coo$riv, points, col = "blue", type = "l", lwd = 2))
    if (label){
        s.label(chevaine$coo$poi, clab = 0.75, add.p = TRUE)
        s.label(chevaine$coo$sta, add.p = TRUE, clab = 0.5)
    }
    arrows(200,100,300,100, code = 3, angle = 15, length = 0.2)
    text(250,125,"50 Km")
}

fun.chevaine()

che.genet <- freq2genet(chevaine$tab)
che.pca <- dudi.pca(che.genet$tab, center = che.genet$center, scannf = FALSE, nf = 3)

par(mfrow = c(1,2))
fun.chevaine(FALSE)
s.value(chevaine$coo$sta, che.pca$li[,1], csi = 2, add.p = TRUE)
fun.chevaine(FALSE)
s.value(chevaine$coo$sta, che.pca$li[,2], csi = 2, add.p = TRUE)

w = prep.fuzzy.var (che.genet$tab, che.genet$loc.blocks)
che.fca <- dudi.fca(w, scannf = FALSE, nf = 3)

fun.chevaine(FALSE)
s.value(chevaine$coo$sta, che.fca$li[,1], csi = 1.5, add.p = TRUE)
fun.chevaine(FALSE)
s.value(chevaine$coo$sta, che.fca$li[,2], csi = 1.5, add.p = TRUE)

} 
\keyword{datasets}

\eof
\name{clementines}
\alias{clementines}
\docType{data}
\title{Fruit Production}
\description{
The \code{clementines} is a data set containing the fruit production of 20 clementine trees during 15 years.
}
\usage{data(clementines)}
\format{
A data frame with 15 rows and 20 columns
}
\source{
Tisné-Agostini, D. (1988) \emph{Description par analyse en composantes principales de l'évolution de 
a production du clémentinier en association avec 12 types de porte-greffe}.
Rapport technique, DEA Analyse et modélisation des systèmes biologiques, Université Lyon 1. 
}
\examples{
data(clementines)
op <- par(no.readonly = TRUE) 
par(mfrow = c(5,4)) ; par(mar = c(2,2,1,1))
for (i in 1:20) {
    w0 <- 1:15 ; plot(w0, clementines[,i], type = "b")
    abline(lm(clementines[,i] ~ w0))
}
par(op)

pca1 <- dudi.pca(clementines, scan = FALSE)
s.corcircle(pca1$co, clab = 0.75)

barplot(pca1$li[,1])

op <- par(no.readonly = TRUE) 
par(mfrow = c(5,4)) ; par(mar = c(2,2,1,1))
clem0 <- pca1$tab
croi <- 1:15
alter <- c(rep(c(1,-1),7),1)
for (i in 1:20) {
    y <- clem0[,i]
    plot(w0, y, type = "b", ylim = c(-2,2))
    z <- predict(lm(clem0[,i] ~ croi*alter))
    points(w0, z, pch = 20, cex = 2)
    for(j in 1:15) segments (j,y[j],j,z[j])
}
par(op)
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{coinertia}
\alias{coinertia}
\alias{print.coinertia}
\alias{plot.coinertia}
\alias{summary.coinertia}
\title{Coinertia Analysis}
\description{
The coinertia analysis performs a double inertia analysis of two arrays. 
}
\usage{
coinertia(dudiX, dudiY, scannf = TRUE, nf = 2)
plot.coinertia (x, xax = 1, yax = 2, \dots) 
print.coinertia (x, \dots) 
summary.coinertia (object, \dots) 
}
\arguments{
  \item{dudiX}{a duality diagram providing from one of the functions dudi.coa, dudi.pca, \dots}
  \item{dudiY}{a duality diagram providing from one of the functions dudi.coa, dudi.pca, \dots}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \cr
  \item{x, object}{an object of class 'coinertia'}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
Returns a list of class 'coinertia', sub-class 'dudi' containing:
  \item{call}{call}
  \item{rank}{rank}
  \item{nf}{a numeric value indicating the number of kept axes}
  \item{RV}{a numeric value, the RV coefficient}
  \item{eig}{a numeric vector with all the eigenvalues}
  \item{lw}{a numeric vector with the rows weigths (crossed array)}
  \item{cw}{a numeric vector with the columns weigths (crossed array)}
  \item{tab}{a crossed array (CA)} 
  \item{li}{Y col = CA row: coordinates}
  \item{l1}{Y col = CA row: normed scores}
  \item{co}{X col = CA column: coordinates}
  \item{c1}{X col = CA column: normed scores}
  \item{lX}{the row coordinates (X)}
  \item{mX}{the normed row scores (X)}
  \item{lY}{the row coordinates (Y)}
  \item{mY}{the normed row scores (Y)}
  \item{aX}{the axis onto co-inertia axis (X)}
  \item{aY}{the axis onto co-inertia axis (Y)}
}
\references{
Dolédec, S. and Chessel, D. (1994) Co-inertia analysis: an alternative method for studying species-environment relationships. \emph{Freshwater Biology}, \bold{31}, 277--294.
}
\section{WARNING }{
IMPORTANT : \code{dudi1} and \code{dudi2} must have identical row weights.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(doubs)
dudi1 <- dudi.pca(doubs$mil, scale = TRUE, scan = FALSE, nf = 3)
dudi2 <- dudi.pca(doubs$poi, scale = FALSE, scan = FALSE, nf = 2)
coin1 <- coinertia(dudi1,dudi2, scan = FALSE, nf = 2)
s.arrow(coin1$l1, clab = 0.7)

s.arrow(coin1$c1, clab = 0.7)

par(mfrow = c(1,2))
s.corcircle(coin1$aX)
s.corcircle(coin1$aY)
par(mfrow = c(1,1))
 
coin1
summary(coin1)
plot(coin1)
}
\keyword{multivariate}

\eof
\name{coleo}
\alias{coleo}
\docType{data}
\title{Table of Fuzzy Biological Traits }
\description{
This data set coleo (coleoptera) is a a fuzzy biological traits table.  
}
\usage{data(coleo)}
\format{
\code{coleo} is a list of 5 components.
\describe{
    \item{tab}{is a data frame with 110 rows (species) and 32 columns (categories).}
    \item{species.names}{is a vector of species names.}
    \item{moda.names}{is a vector of fuzzy variables names.}
    \item{families}{is a factor species family.}
    \item{col.blocks}{is a vector containing the number of categories of each trait.}
    }
}
\source{
Bournaud, M., Richoux, P. and Usseglio-Polatera, P. (1992)
An approach to the synthesis of qualitative ecological information from aquatic coleoptera communities.
\emph{Regulated rivers: Research and Management}, \bold{7}, 165--180.
}
\examples{
data(coleo)
op <- par(no.readonly = TRUE) 
coleo.fuzzy <- prep.fuzzy.var(coleo$tab, coleo$col.blocks)
fca1 <- dudi.fca(coleo.fuzzy, sca = FALSE, nf = 3)
par(mfrow = c(3,3))
indica <- factor(rep(names(coleo$col), coleo$col))
for (j in levels(indica)) s.distri (fca1$l1,
    coleo$tab[,which(indica==j)], clab = 1.5, sub = as.character(j), 
    cell = 0, csta = 0.5, csub = 3, 
    label = coleo$moda.names[which(indica == j)])
par(op)
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{corkdist}
\alias{corkdist}
\alias{mantelkdist}
\alias{RVkdist}
\alias{print.corkdist}
\alias{summary.corkdist}
\alias{plot.corkdist}
\title{Tests of randomization on the correlation between distances applied to 'kdist' objetcs}
\description{
The mantelkdist and RVkdist functions apply to blocks of distance matrices the mantel.rtest et RV.rtest functions.
}
\usage{
mantelkdist (kd, nrepet = 999)
RVkdist (kd, nrepet = 999)
plot.corkdist (x, whichinrow = NULL, whichincol = NULL, 
   gap = 4, nclass = 10, coeff = 1,\dots)
}
\arguments{
  \item{kd}{a list of class \code{kdist}}
  \item{nrepet}{the number of permutations}
  \item{x}{an objet of class \code{corkdist}, coming from RVkdist or mantelkdist}
  \item{whichinrow}{a vector of integers to select the graphs in rows (if NULL all the graphs are computed)}
  \item{whichincol}{a vector of integers to select the graphs in columns (if NULL all the graphs are computed)}
  \item{gap}{an integer to determinate the space between two graphs}
  \item{nclass}{a number of intervals for the histogram}
  \item{coeff}{an integer to fit the magnitude of the graph}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
a list of class \code{corkdist} containing for each pair of distances an object of class \code{randtest} (permutation tests).
}
\details{
The \code{corkdist} class has some generic functions \code{print}, \code{plot} and \code{summary}. The plot shows bivariate scatterplots between semi-matrices of distances or histograms of simulated values with an error position.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}\cr
Anne B Dufour \email{dufour@biomserv.univ-lyon1.fr}
}
\examples{
data(friday87)
fri.w <- ktab.data.frame(friday87$fau, friday87$fau.blo, 
    tabnames = friday87$tab.names)
fri.kc <- lapply(1:10, function(x) dist.binary(fri.w[[x]],10))
names(fri.kc) <-  substr(friday87$tab.names,1,4)
fri.kd <- kdist(fri.kc)
 fri.mantel = mantelkdist(kd = fri.kd, nrepet = 999)
 plot(fri.mantel,1:5,1:5)
 plot(fri.mantel,1:5,6:10)
 plot(fri.mantel,6:10,1:5)
 plot(fri.mantel,6:10,6:10)
s.corcircle (dudi.pca(as.data.frame(fri.kd), scan = FALSE)$co)
plot(RVkdist(fri.kd),1:5,1:5)

data(yanomama)
m1 <- mantelkdist(kdist(yanomama),999)
m1
summary(m1)
plot(m1)
}
\keyword{nonparametric}

\eof
\name{corvus}
\alias{corvus}
\docType{data}
\title{Corvus morphology}
\description{
This data set gives a morphological description of 28 species of the genus Corvus split in two habitat types and phylogeographic stocks.
}
\usage{data(corvus)}
\format{
\code{corvus} is data frame with 28 observations (the species) and 4 variables : 
   \item{wing}{: wing length (cm)}
   \item{bill}{: bill length (cm)}
   \item{habitat}{: habitat with two levels \code{clos} and \code{open}}
   \item{phylog}{: phylogeographic stock with three levels \code{amer}(America), \code{orien}(Oriental-Australian),
    \code{pale}(Paleoarctic-African)}
}
\references{
Laiolo, P. and Rolando, A. (2003) The evolution of vocalisations in the genus Corvus: effects of phylogeny, morphology and habitat. 
\emph{Evolutionary Ecology}, \bold{17}, 111--123.
}
\examples{
data(corvus)
plot(corvus[,1:2])
s.class(corvus[,1:2], corvus[,4]:corvus[,3], add.p = TRUE)
}
\keyword{datasets}

\eof
\name{deug}
\alias{deug}
\docType{data}
\title{Exam marks for some students}
\description{
This data set gives the exam results of 104 students in the second year of a French University onto 9 subjects. 
}
\usage{data(deug)}
\format{
    \code{deug} is a list of three components.
    \describe{
    \item{tab}{is a data frame with 104 students and 9 subjects : Algebra, Analysis, Proba, Informatic, Economy,
    Option1, Option2, English, Sport.}
    \item{result}{is a factor of 104 components giving the final exam levels (A+, A, B, B-, C-, D).}
    \item{cent}{is a vector of required marks by subject to get exactly 10/20 with a coefficient.}
    }
}
\source{
University of Lyon 1
}
\examples{
data(deug)
# decentred PCA
pca1 <- dudi.pca(deug$tab, scal = FALSE, center = deug$cent, 
    scan = FALSE)
s.class(pca1$li, deug$result)
s.arrow(40 * pca1$c1, add.plot = TRUE)
}
\keyword{datasets}

\eof
\name{disc}
\alias{disc}
\title{Rao's dissimilarity coefficient}
\description{
Calculates the root square of Rao's dissimilarity coefficient between samples.
}
\usage{
disc(samples, dis = NULL, structures = NULL)
}
\arguments{
  \item{samples}{a data frame with elements as rows, samples as columns,
  and abundance, presence-absence or frequencies as entries}
  \item{dis}{an object of class \code{dist} containing distances or dissimilarities among elements.
  If \code{dis} is NULL, equidistances are used.}
  \item{structures}{a data frame containing, in the jth row and the kth column,
  the name of the group of level k to which the jth population belongs.}
}
\value{
Returns a list of objects of class \code{dist}
}
\references{
Rao, C.R. (1982) Diversity and dissimilarity coefficients: a unified approach.
\emph{Theoretical Population Biology}, \bold{21}, 24--43.
}
\author{Sandrine Pavoine \email{pavoine@biomserv.univ-lyon1.fr}
}
\examples{
data(humDNAm)
humDNA.dist <- disc(humDNAm$samples, sqrt(humDNAm$distances), humDNAm$structures)
humDNA.dist
is.euclid(humDNA.dist$samples)
is.euclid(humDNA.dist$regions)

\dontrun{
data(ecomor)
ecomor.phylog <- taxo2phylog(ecomor$taxo)
ecomor.dist <- disc(ecomor$habitat, ecomor.phylog$Wdist)
ecomor.dist
is.euclid(ecomor.dist)
}
}
\keyword{multivariate}

\eof
\name{discrimin}
\alias{discrimin}
\alias{plot.discrimin}
\alias{print.discrimin}
\title{Linear Discriminant Analysis (descriptive statistic)}
\description{
performs a linear discriminant analysis. 
}
\usage{
discrimin(dudi, fac, scannf = TRUE, nf = 2)
plot.discrimin (x, xax = 1, yax = 2, \dots) 
print.discrimin (x, \dots) 
}
\arguments{
  \item{dudi}{a duality diagram, object of class \code{dudi}}
  \item{fac}{a factor defining the classes of discriminant analysis}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \cr

  \item{x}{an object of class 'discrimin'}
  \item{xax}{the column number of the x-axis}
  \item{yax}{the column number of the y-axis}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns a list of class 'discrimin' containing :
  \item{nf}{a numeric value indicating the number of kept axes}
  \item{eig}{a numeric vector with all the eigenvalues}
  \item{fa}{a matrix with the loadings: the canonical weights}
  \item{li}{a data frame which gives the canonical scores}
  \item{va}{a matrix which gives the cosines between the variables and the canonical scores}
  \item{cp}{a matrix which gives the cosines between the components and the canonical scores}
  \item{gc}{a data frame which gives the class scores}
}
\seealso{\code{lda} in package \code{MASS}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(chazeb)
dis1 <- discrimin(dudi.pca(chazeb$tab, scan = FALSE), chazeb$cla, 
    scan = FALSE)
dis1
plot(dis1)

data(skulls)
plot(discrimin(dudi.pca(skulls, scan = FALSE), gl(5,30), 
    scan = FALSE))
}
\keyword{multivariate}

\eof
\name{discrimin.coa}
\alias{discrimin.coa}
\title{Discriminant Correspondence Analysis
}
\description{
performs a discriminant correspondence analysis. 
}
\usage{
discrimin.coa(df, fac, scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame containing positive or null values}
  \item{fac}{a factor defining the classes of discriminant analysis}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
a list of class \code{discrimin}. See \code{\link{discrimin}}
}
\references{
Perriere, G.,Lobry,  J. R.  and Thioulouse J. (1996) Correspondence discriminant analysis: a multivariate method for comparing 
classes of protein and nucleic acid sequences. \emph{CABIOS}, \bold{12}, 519--524.\cr

Perriere, G. and Thioulouse, J. (2003) Use of Correspondence Discriminant Analysis to predict the subcellular location of bacterial proteins. 
\emph{Computer Methods and Programs in Biomedicine}, \bold{70}, 2, 99--105.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(perthi02)
plot(discrimin.coa(perthi02$tab, perthi02$cla, scan = FALSE))
}
\keyword{multivariate}

\eof
\name{dist.binary}
\alias{dist.binary}
\title{Computation of Distance Matrices for Binary Data}
\description{
computes for binary data some distance matrice. 
}
\usage{
dist.binary(df, method = NULL, diag = FALSE, upper = FALSE)
}
\arguments{
  \item{df}{a data frame with positive or zero values. Used with \code{as.matrix(1 * (df > 0))}}
  \item{method}{an integer between 1 and 10 . If NULL the choice is made with a console message. See details}
  \item{diag}{a logical value indicating whether the diagonal of the distance matrix should be printed by `print.dist'}
  \item{upper}{a logical value indicating whether the upper triangle of the distance matrix should be printed by `print.dist'}
}
\details{
All these distances are of type \eqn{d=\sqrt{1-s}}{d = sqrt(1 - s)} with s a similarity coefficient. 
\item{1 = Jaccard index (1901)}{S3 coefficient of Gower & Legendre \eqn{s_1 = \frac{a}{a+b+c}}{s1 = a / (a+b+c)}}
\item{2 = Sockal & Michener index (1958)}{S4 coefficient of Gower & Legendre \eqn{s_2 =\frac{a+d}{a+b+c+d}}{s2 = (a+d) / (a+b+c+d)}}
\item{3 = Sockal & Sneath(1963)}{S5 coefficient of Gower & Legendre \eqn{s_3 =\frac{a}{a+2(b+c)}}{s3 = a / (a + 2(b + c))}}
\item{4 = Rogers & Tanimoto (1960)}{S6 coefficient of Gower & Legendre \eqn{s_4 =\frac{a+d}{(a+2(b+c)+d)}}{s4 = (a + d) / (a + 2(b + c) +d)}}
\item{5 = Czekanowski (1913) or Sorensen (1948)}{S7 coefficient of Gower & Legendre \eqn{s_5 =\frac{2*a}{2*a+b+c}}{s5 = 2a / (2a + b + c)}}
\item{6 = S9 index of Gower & Legendre (1986)}{\eqn{s_6 =\frac{a-(b+c)+d}{a+b+c+d}}{s6 = (a - (b + c) + d) / (a + b + c + d)}}
\item{7 = Ochiai (1957)}{S12 coefficient of Gower & Legendre \eqn{s_7 =\frac{a}{\sqrt{(a+b)(a+c)}}}{s7 = a / sqrt((a + b)(a + c))}}
\item{8 = Sockal & Sneath (1963)}{S13 coefficient of Gower & Legendre \eqn{s_8 =\frac{ad}{sqrt{(a+b)(a+c)(d+b)(d+c)}}}{s8 = ad / sqrt((a + b)(a + c)(d + b)(d + c))}}
\item{9 = Phi of Pearson}{S14 coefficient of Gower & Legendre \eqn{s_9 =\frac{ad-bc}{\sqrt{(a+b)(a+c)(b+d)(d+c)}}}{s9 = (ad - bc) / sqrt((a + b)(a + c)(d + b)(d + c))}}
\item{10 = S2 coefficient of Gower & Legendre}{\eqn{s_1 = \frac{a}{a+b+c+d}}{s10 = a / (a + b + c + d)}}
}
\value{
returns a distance matrix of class \code{dist} between the rows of the data frame
}
\references{Gower, J.C. and Legendre, P. (1986) Metric and Euclidean properties of dissimilarity coefficients. 
\emph{Journal of Classification}, \bold{3}, 5--48.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(aviurba)
for (i in 1:10) {
    d <- dist.binary(aviurba$fau, method = i)
    cat(attr(d, "method"), is.euclid(d), "\n")}
}
\keyword{array}
\keyword{multivariate}

\eof
\name{dist.dudi}
\alias{dist.dudi}
\title{Computation of the Distance Matrix of a Statistical Triplet
}
\description{
computes for a statistical triplet a distance matrix. 
}
\usage{
dist.dudi(dudi, amongrow = TRUE)
}
\arguments{
  \item{dudi}{a duality diagram, object of class \code{dudi}}
  \item{amongrow}{a logical value computing the distance if TRUE, between rows, if FALSE between columns.}
}
\value{
an object of class \code{dist}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data (meaudret)
pca1 <- dudi.pca(meaudret$mil, scan = FALSE)
sum((dist(scalewt(meaudret$mil)) - dist.dudi(pca1))^2)
#[1] 4.045e-29 the same thing
}
\keyword{array}
\keyword{multivariate}

\eof
\name{dist.genet}
\alias{dist.genet}
\title{ Genetic distances from gene frequencies }
\description{
  This program computes any one of five measures of genetic distance from a set of gene frequencies in different populations with several loci.
}
\usage{
dist.genet(genet, method = 1, diag = FALSE, upper = FALSE)
}
\arguments{
  \item{genet}{ a list of class \code{genet}  }
  \item{method}{ an integer between 1 and 5. See details }
  \item{diag}{ a logical value indicating whether the diagonal of the distance matrix should be printed by \code{print.dist} }
  \item{upper}{ a logical value indicating whether the upper triangle of the distance matrix should be printed by \code{print.dist} }
}
\details{
Let \bold{A} a table containing allelic frequencies with \emph{t} populations (rows) and \emph{m} alleles (columns).\cr
Let  \eqn{\nu} the number of loci. The locus \emph{j} gets \emph{m(j)} alleles. 
\eqn{m=\sum_{j=1}^{\nu} m(j)}\cr

For the row \emph{i} and the modality \emph{k} of the variable \emph{j}, notice the value \eqn{a_{ij}^k} (\eqn{1 \leq i \leq t}, \eqn{1 \leq j \leq \nu},
\eqn{1 \leq k \leq m(j)}) the value of the initial table.\cr

\eqn{a_{ij}^+=\sum_{k=1}^{m(j)}a_{ij}^k} and \eqn{p_{ij}^k=\frac{a_{ij}^k}{a_{ij}^+}}\cr

Let \bold{P} the table of general term \eqn{p_{ij}^k}\cr
\eqn{p_{ij}^+=\sum_{k=1}^{m(j)}p_{ij}^k=1}, \eqn{p_{i+}^+=\sum_{j=1}^{\nu}p_{ij}^+=\nu}, \eqn{p_{++}^+=\sum_{j=1}^{\nu}p_{i+}^+=t\nu}\cr

The option \code{method} computes the distance matrices between populations using the frequencies \eqn{p_{ij}^k}. \cr
1. Nei's distance: \cr
\eqn{D_1(a,b)=- \ln(\frac{\sum_{k=1}^{\nu} \sum_{j=1}^{m(k)}
p_{aj}^k p_{bj}^k}{\sqrt{\sum_{k=1}^{\nu} \sum_{j=1}^{m(k)}
{(p_{aj}^k) }^2}\sqrt{\sum_{k=1}^{\nu} \sum_{j=1}^{m(k)}
{(p_{bj}^k)}^2}})}\cr

2. Angular distance or Edwards' distance:\cr
\eqn{D_2(a,b)=\sqrt{1-\frac{1}{\nu} \sum_{k=1}^{\nu}
\sum_{j=1}^{m(k)} \sqrt{p_{aj}^k  p_{bj}^k}}}\cr

3. Coancestrality coefficient or Reynolds' distance:\cr
\eqn{D_3(a,b)=\sqrt{\frac{\sum_{k=1}^{\nu}
\sum_{j=1}^{m(k)}{(p_{aj}^k - p_{bj}^k)}^2}{2 \sum_{k=1}^{\nu} (1-
\sum_{j=1}^{m(k)}p_{aj}^k p_{bj}^k)}}}\cr

4. Classical Euclidean distance or Rogers' distance:\cr
\eqn{D_4(a,b)=\frac{1}{\nu} \sum_{k=1}^{\nu} \sqrt{\frac{1}{2}
\sum_{j=1}^{m(k)}{(p_{aj}^k - p_{bj}^k)}^2}}\cr

5. Absolute genetics distance or Provesti 's distance:\cr
\eqn{D_5(a,b)=\frac{1}{2{\nu}} \sum_{k=1}^{\nu} \sum_{j=1}^{m(k)}
|p_{aj}^k - p_{bj}^k|}
}
\value{
returns a distance matrix of class \code{dist} between the rows of the data frame
}
\references{ 
To complete informations about distances:\cr

Distance 1:\cr
Nei, M. (1972) Genetic distances between populations. \emph{American Naturalist}, \bold{106}, 283--292. \cr
Nei M. (1978) Estimation of average heterozygosity and genetic distance from a small number of individuals. \emph{Genetics}, \bold{23}, 341--369. \cr
Avise, J. C. (1994) Molecular markers, natural history and evolution. Chapman & Hall, London. 

Distance 2:\cr
Edwards, A.W.F. (1971) Distance between populations on the basis of gene frequencies. \emph{Biometrics}, \bold{27}, 873--881. \cr
Cavalli-Sforza L.L. and Edwards A.W.F. (1967) Phylogenetic analysis: models and estimation procedures. \emph{Evolution}, \bold{32}, 550--570. \cr
Hartl, D.L. and Clark, A.G. (1989) Principles of population genetics. Sinauer Associates, Sunderland, Massachussetts (p. 303).

Distance 3:\cr
Reynolds, J. B., B. S. Weir, and C. C. Cockerham. (1983) Estimation of the coancestry coefficient: basis for a short-term genetic distance. \emph{Genetics}, \bold{105}, 767--779.

Distance 4:\cr
Rogers, J.S. (1972) Measures of genetic similarity and genetic distances. \emph{Studies in Genetics}, Univ. Texas Publ., \bold{7213}, 145--153.  \cr
Avise, J. C. (1994) Molecular markers, natural history and evolution. Chapman & Hall, London. 

Distance 5:\cr
Prevosti A. (1974) La distancia genética entre poblaciones. \emph{Miscellanea Alcobé}, \bold{68}, 109--118. \cr
Prevosti A., Ocaña J. and Alonso G. (1975) Distances between populations of Drosophila subobscura, based on chromosome arrangements frequencies. \emph{Theoretical and Applied Genetics}, \bold{45}, 231--241. \cr

To find some useful explanations:\cr
Sanchez-Mazas A. (2003) Cours de Génétique Moléculaire des Populations. Cours VIII Distances génétiques - Représentation des populations. \cr
\url{http://anthro.unige.ch/GMDP/Alicia/GMDP_dist.htm}
}
\author{ Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}\cr
Anne B Dufour \email{dufour@biomserv.univ-lyon1.fr} 
}
\examples{
data(casitas)
casi.genet <- char2genet(casitas,
    as.factor(rep(c("dome", "cast", "musc", "casi"), c(24,11,9,30))))
ldist <- lapply(1:5, function(method) dist.genet(casi.genet,method))
ldist
unlist(lapply(ldist, is.euclid))
kdist(ldist)
}
\keyword{ multivariate }

\eof
\name{dist.neig}
\alias{dist.neig}
\title{Computation of the Distance Matrix associated to a Neighbouring Graph
}
\description{
  This distance matrix  between two points is the length of the shortest path between
these points. 
}
\usage{
dist.neig(neig)
}
\arguments{
  \item{neig}{a neighbouring graph, object of class \code{neig}}
}
\value{
returns a distance matrix, object of class \code{dist}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
library(mva)
    data(elec88)
    d0 <- dist.neig(elec88$neig)
    plot(dist(elec88$xy),d0)
}
\keyword{array}
\keyword{multivariate}

\eof
\name{dist.prop}
\alias{dist.prop}
\title{Computation of Distance Matrices of Percentage Data
}
\description{
computes for percentage data some distance matrices. 
}
\usage{
dist.prop(df, method = NULL, diag = FALSE, upper = FALSE)
}
\arguments{
  \item{df}{a data frame containing only positive or null values, used as row percentages}
  \item{method}{an integer between 1 and 5. If NULL the choice is made with a console message. See details}
  \item{diag}{a logical value indicating whether the diagonal of the distance matrix should be printed by `print.dist'}
  \item{upper}{a logical value indicating whether the upper triangle of the distance matrix should be printed by `print.dist'}
}
\details{
\item{1 = Manly}{\eqn{d_1=\frac{1}{2} \sum_{i=1}^{K}{|{p_i-q_i}|}}{d1 = sum|p(i) - q(i)|/2}}
\item{2 = Overlap index Manly}{\eqn{d_2=1-\frac{\sum_{i=1}^{K}{p_i}}{\sqrt{\sum_{i=1}^{K}{p_i^2}}{\sqrt{\sum_{i=1}^{K}{q_i^2}}}}}{d2 = 1 - Sum(p(i)q(i))/sqrt(Sum(p(i)^2)/sqrt(Sum(q(i)^2)}}
\item{3 = Rogers 1972 (one locus)}{\eqn{d_3=\frac{1}{n} \sqrt{\frac{1}{2} \sum_{i=1}^{K}{({p_i-q_i})^2}}}{d3 = sqrt(0.5*Sum(p(i)-q(i)^2))}}
\item{4 = Nei 1972 (one locus)}{\eqn{d_4=\frac{1}{n} \ln{\frac{\sum_{i=1}^{K}{p_i q_i}}{\sqrt{\sum_{i=1}^{K}{p_i^2}}{\sqrt{\sum_{i=1}^{K}{q_i^2}}}}}}{d4 = -ln(Sum(p(i)q(i)/sqrt(Sum(p(i)^2)/sqrt(Sum(q(i)^2))}}
\item{5 = Edwards 1971 (one locus)}{\eqn{d_5=\sqrt{1-\sum_{i=1}^{K}{\sqrt{p_1 q_i}}}}{d5= sqrt (1 - (Sum(sqrt(p(i)q(i))))}}
}
\value{
returns a distance matrix, object of class \code{dist}
}
\references{
Edwards, A. W. F. (1971) Distance between populations on the basis of gene frequencies. \emph{Biometrics}, \bold{27}, 
873--881. 

Manly, B. F. (1994) \emph{Multivariate Statistical Methods. A primer.}, Second edition. Chapman & Hall, London.

Nei, M. (1972) Genetic distances between populations. \emph{The American Naturalist}, \bold{106}, 283--292. 
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(microsatt)
w <- microsatt$tab[1:microsatt$loci.eff[1]]
par(mfrow = c(2,2))
scatter(dudi.pco(lingoes(dist.prop(w,1)), scann = FALSE))
scatter(dudi.pco(lingoes(dist.prop(w,2)), scann = FALSE))
scatter(dudi.pco(dist.prop(w,3), scann = FALSE))
scatter(dudi.pco(lingoes(dist.prop(w,4)), scann = FALSE))
par(mfrow = c(1,1))}
\keyword{array}
\keyword{multivariate}

\eof
\name{dist.quant}
\alias{dist.quant}
\title{Computation of Distance Matrices on Quantitative Variables}
\description{
computes on quantitative variables, some distance matrices as canonical, Joreskog and Mahalanobis. 
}
\usage{
dist.quant(df, method = NULL, diag = FALSE, upper = FALSE, 
    tol = 1e-07)
}
\arguments{
  \item{df}{a data frame containing only quantitative variables}
  \item{method}{an integer between 1 and 3. If NULL the choice is made with a console message. See details}
  \item{diag}{a logical value indicating whether the diagonal of the distance matrix should be printed by `print.dist'}
  \item{upper}{a logical value indicating whether the upper triangle of the distance matrix should be printed by `print.dist'}
  \item{tol}{used in case 3 of \code{method} as a tolerance threshold for null eigenvalues}
}
\details{
All the distances are of type \eqn{d=\|x-y\|_A = \sqrt{(x-y)^{t}A(x-y)}}{d = ||x-y||_A = sqrt((x-y)^t A (x-y))}
  \item{1 = Canonical}{A = Identity}
  \item{2 = Joreskog}{\eqn{A=\frac{1}{diag(cov)}}{A = 1 / diag(cov)}}
  \item{3 = Mahalanobis}{A = inv(cov)} 
}
\value{
an object of class \code{dist}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
library(mva)
data(ecomor)
par(mfrow = c(2,2))
scatter(dudi.pco(dist.quant(ecomor$morpho,3), scan = FALSE))
scatter(dudi.pco(dist.quant(ecomor$morpho,2), scan = FALSE))
scatter(dudi.pco(dist(scalewt(ecomor$morpho)), scan = FALSE))
scatter(dudi.pco(dist.quant(ecomor$morpho,1), scan = FALSE))
par(mfrow = c(1,1))}
\keyword{array}
\keyword{multivariate}

\eof
\name{divc}
\alias{divc}
\title{Rao's diversity coefficient also called quadratic entropy}
\description{
Calculates Rao's diversity coefficient within samples.
}
\usage{
divc(df, dis)
}
\arguments{
  \item{df}{a data frame with elements as rows, samples as columns,
  and abundance, presence-absence or frequencies as entries}
  \item{dis}{an object of class \code{dist} containing distances or dissimilarities among elements.
  If \code{dis} is NULL, Gini-Simpson index is performed.}
}
\value{
Returns a data frame with samples as rows and the diversity coefficient within samples as column
}
\references{
Rao, C.R. (1982) Diversity and dissimilarity coefficients: a unified approach.
\emph{Theoretical Population Biology}, \bold{21}, 24--43.

Gini, C. (1912) Variabilitá e mutabilitá. \emph{Universite di Cagliari III}, Parte II.

Simpson, E.H. (1949) Measurement of diversity. \emph{Nature}, \bold{163}, 688.

}
\author{Sandrine Pavoine \email{pavoine@biomserv.univ-lyon1.fr}
}
\examples{
data(humDNAm)
divc(humDNAm$samples, sqrt(humDNAm$distances))
\dontrun{
data(ecomor)
ecomor.phylog <- taxo2phylog(ecomor$taxo)
divc(ecomor$habitat, ecomor.phylog$Wdist)
}}
\keyword{multivariate}

\eof
\name{dotcircle}
\alias{dotcircle}
\title{Representation of n values on a circle}
\description{
This function represents \emph{n} values on a circle. The \emph{n} points are shared out regularly over the circle and put on the radius according to the value attributed to that measure.
}
\usage{
dotcircle(z, alpha0 = pi/2, xlim = range(pretty(z)),
 labels = names(z), clabel = 1, cleg = 1)
}
\arguments{
  \item{z}{: a numeric vector}
  \item{alpha0}{: polar angle to put the first value}
  \item{xlim}{: the ranges to be encompassed by the circle radius}
  \item{labels}{: a vector of strings of characters for the angle labels}
  \item{clabel}{: a character size for the labels, used with  \code{par("cex")*clabel}}
  \item{cleg}{: a character size for the ranges, used with \code{par("cex")*cleg}}
}
\seealso{\code{\link[CircStats]{circ.plot}}}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
w <- scores.neig(neig(n.cir = 24))
par(mfrow = c(4,4))
for (k in 1:16) dotcircle(w[,k],labels = 1:24)
par(mfrow = c(1,1))
}
\keyword{hplot}

\eof
\name{doubs}
\alias{doubs}
\docType{data}
\title{Pair of Ecological Tables}
\description{
This data set gives environmental variables, fish species and spatial coordinates for 30 sites. 
}
\usage{data(doubs)}
\format{
    \code{doubs} is a list with 3 components.
    \describe{
        \item{mil}{is a data frame with 30 rows (sites) and 11 environmental variables.}
        \item{poi}{is a data frame with 30 rows (sites) and 27 fish species.}
        \item{xy}{is a data frame with 30 rows (sites)  and 2 spatial coordinates.}
    }
}
\source{
 Verneaux, J. (1973) 
 \emph{Cours d'eau de Franche-Comté (Massif du Jura). 
 Recherches écologiques sur le réseau hydrographique du Doubs. Essai de biotypologie}. 
 Thèse d'état, Besançon. 1--257.
}
\examples{
data(doubs)
pca1 <- dudi.pca(doubs$mil, scan = FALSE)
pca2 <- dudi.pca(doubs$poi, scale = FALSE, scan = FALSE)
coiner1 <- coinertia(pca1, pca2, scan = FALSE)
par(mfrow = c(3,3))
s.corcircle(coiner1$aX)
s.value(doubs$xy, coiner1$lX[,1])
s.value(doubs$xy, coiner1$lX[,2])
s.arrow(coiner1$c1)
s.match(coiner1$mX, coiner1$mY)
s.corcircle(coiner1$aY)
s.arrow(coiner1$l1)
s.value(doubs$xy, coiner1$lY[,1])
s.value(doubs$xy, coiner1$lY[,2])
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{dpcoa}
\alias{dpcoa}
\alias{plot.dpcoa}
\alias{print.dpcoa}
\title{Double principal coordinate analysis}
\description{
Performs a double principal coordinate analysis  
}
\usage{
dpcoa (df, dis = NULL, scannf = TRUE, nf = 2, full = FALSE, tol = 1e-07)
plot.dpcoa (x, xax = 1, yax = 2, option = 1:4, csize = 2, \dots)
print.dpcoa (x, \dots)
}
\arguments{
  \item{df}{a data frame with elements as rows, samples as columns and abundance or presence-absence as entries}
  \item{dis}{an object of class \code{dist} containing the distances between the elements.}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf is FALSE, an integer indicating the number of kept axes}
  \item{full}{a logical value indicating whether all non null eigenvalues should be kept}
  \item{tol}{a tolerance threshold for null eigenvalues (a value less than tol times the first one is considered as null)}
  \item{x}{an object of class \code{dpcoa}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{option}{the function \code{plot.dpcoa} produces four graphs, \code{option} allows us to choose only some of them}
  \item{csize}{a size coefficient for symbols}
  \item{\dots}{\code{\dots} further arguments passed to or from other methods}
}
\value{
Returns a list of class \code{dpcoa} containing:
  \item{call}{call}
  \item{nf}{a numeric value indicating the number of kept axes}
  \item{w1}{a numeric vector containing the weights of the elements}
  \item{w2}{a numeric vector containing the weights of the samples}
  \item{eig}{a numeric vector with all the eigenvalues}
  \item{RaoDiv}{a numeric vector containing diversities within samples}
  \item{RaoDis}{an object of class \code{dist} containing the dissimilarities between samples}
  \item{RaoDecodiv}{a data frame with the decomposition of the diversity}
  \item{l1}{a data frame with the coordinates of the elements}
  \item{l2}{a data frame with the coordinates of the samples}
  \item{c1}{a data frame with the scores of the principal axes of the elements}
}
\references{
  Pavoine, S., Dufour, A.B. and Chessel, D. (in press) From dissimilarities among species to dissimilarities among communities:
  a double principal coordinate analysis. \emph{Journal of Theoretical Biology}.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sandrine Pavoine \email{pavoine@biomserv.univ-lyon1.fr} \cr
Anne B Dufour \email{dufour@biomserv.univ-lyon1.fr}
}
\examples{
data(humDNAm)
dpcoahum <- dpcoa(humDNAm$samples, sqrt(humDNAm$distances), scan = FALSE, nf = 2)
dpcoahum
plot(dpcoahum, csize = 1.5)
\dontrun{
data(ecomor)
ecomor.phylog <- taxo2phylog(ecomor$taxo)
dpcoaeco <- dpcoa(ecomor$habitat, ecomor.phylog$Wdist, scan = FALSE, nf = 2)
dpcoaeco
plot(dpcoaeco, csize = 1.5)}
}
\keyword{multivariate}

\eof
\name{dudi}
\alias{dudi}
\alias{as.dudi}
\alias{print.dudi}
\alias{t.dudi}
\alias{is.dudi}
\alias{redo.dudi}
\title{Duality Diagram}
\description{
\code{as.dudi} is called by many functions (\code{dudi.pca}, \code{dudi.coa}, \code{dudi.acm}, ...) 
and not directly by the user. It creates duality diagrams.

\code{t.dudi} returns an object of class 'dudi' where the rows are the columns and the columns are the rows
of the initial dudi. 

\code{is.dudi} returns TRUE if the object is of class \code{dudi} 

\code{redo.dudi} computes again an analysis, eventually changing the number of kept axes. Used by other functions.\cr
}
\usage{
as.dudi(df, col.w, row.w, scannf, nf, call, type, tol = 1e-07, 
    full = FALSE) 
print.dudi(x, \dots) 
is.dudi(x) 
redo.dudi(dudi, newnf = 2) 
t.dudi(x) 
}
\arguments{
  \item{df}{a data frame with n rows and p columns}
  \item{col.w}{a numeric vector containing the row weights}
  \item{row.w}{a numeric vector containing the column weights}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \item{call}{generally \code{match.call()}}
  \item{type}{a string of characters : the returned list will be of class \code{c(type, "dudi")}}
  \item{tol}{a tolerance threshold for null eigenvalues (a value less than tol times the first one is considered as null)}
  \item{full}{a logical value indicating whether all non null eigenvalues should be kept}
  \item{x, dudi}{objects of class \code{dudi}}
  \item{\dots}{further arguments passed to or from other methods}
  \item{newnf}{an integer indicating the number of kept axes}
}
\value{
as.dudi and all the functions that use it return a list with the following components :
\item{tab}{a data frame with n rows et p columns}
\item{cw}{row weights, a vector with n components} 
\item{lw}{column weights, a vector with p components}
\item{eig}{eigenvalues, a vector with min(n,p) components}
\item{nf}{integer, number of kept axes}
\item{c1}{principal axes, data frame with p rows et nf columns}
\item{l1}{principal components, data frame with n rows et nf columns}
\item{co}{column coordinates, data frame with p rows et nf columns}
\item{li}{row coordinates, data frame with n rows et nf columns}
\item{call}{original call}
}
\references{Escoufier, Y. (1987) 
The duality diagram  : a means of better practical applications 
In \emph{Development in numerical ecology}, Legendre, P. & Legendre, L. (Eds.) 
NATO advanced Institute,  Serie G. Springer Verlag, Berlin,  139--156.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(deug)
dd1 <- dudi.pca(deug$tab, scannf = FALSE)
dd1
t(dd1)
is.dudi(dd1)
redo.dudi(dd1,3)
}
\keyword{multivariate}

\eof
\name{dudi.acm}
\alias{dudi.acm}
\alias{acm.burt}
\alias{acm.disjonctif}
\alias{boxplot.acm}
\title{Multiple Correspondence Analysis}
\description{
\code{dudi.acm} performs the multiple correspondence analysis of a factor table.\cr
\code{acm.burt} an utility giving the crossed Burt table of two factors table.\cr
\code{acm.disjonctif} an utility giving the complete disjunctive table of a factor table.\cr
\code{boxplot.acm} a graphic utility to interpret axes.\cr
}
\usage{
dudi.acm (df, row.w = rep(1, nrow(df)), scannf = TRUE, nf = 2)
acm.burt (df1, df2, counts = rep(1, nrow(df1))) 
acm.disjonctif (df) 
boxplot.acm (x, xax = 1, \dots) 
}
\arguments{
  \item{df, df1, df2}{data frames containing only factors}
  \item{row.w, counts}{vector of row weights, by default, uniform weighting}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \item{x}{an object of class \code{acm}}
  \item{xax}{the number of factor to display}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
\code{dudi.acm} returns a list of class \code{acm} and \code{dudi} (see \link{dudi}) containing  
\item{cr}{ a data frame which rows are the variables, columns are the kept scores and the values
are the correlation ratios}
}
\references{
Tenenhaus, M. & Young, F.W. (1985) An analysis and synthesis of multiple correspondence analysis, 
optimal scaling, dual scaling, homogeneity analysis ans other methods for quantifying categorical multivariate data. 
\emph{Psychometrika}, \bold{50}, 1, 91-119.

Lebart, L., A. Morineau, and M. Piron. 1995. Statistique exploratoire multidimensionnelle. Dunod, Paris.
}
\seealso{
    \code{\link{s.chull}}, \code{\link{s.class}}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(ours)
summary(ours)
boxplot(dudi.acm(ours, scan = FALSE))
\dontrun{
data(banque)
banque.acm <- dudi.acm(banque, scann = FALSE, nf = 3)
scatter.dudi(banque.acm)

apply(banque.acm$cr, 2, mean)
banque.acm$eig[1:banque.acm$nf] # the same thing
boxplot.acm(banque.acm)

scatter(banque.acm)

s.value(banque.acm$li, banque.acm$li[,3])

bb <- acm.burt(banque, banque)
bbcoa <- dudi.coa(bb, scann = FALSE)
plot(banque.acm$c1[,1], bbcoa$c1[,1])
# mca and coa of Burt table. Lebart & coll. section 1.4

bd <- acm.disjonctif(banque)
bdcoa <- dudi.coa(bd, scann = FALSE)
plot(banque.acm$li[,1], bdcoa$li[,1]) 
# mca and coa of disjonctive table. Lebart & coll. section 1.4
plot(banque.acm$co[,1], dudi.coa(bd, scann = FALSE)$co[,1]) 
}}
\keyword{multivariate}

\eof
\name{dudi.coa}
\alias{dudi.coa}
\title{Correspondence Analysis}
\description{
performs a correspondence analysis. 
}
\usage{
dudi.coa(df, scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame containing positive or null values}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
returns a list of class \code{coa} and \code{dudi} (see \link{dudi}) containing 
  \item{N}{the sum of all the values of the initial table}
}
\references{
Benzécri, J.P. and Coll. (1973) \emph{L'analyse des données. II L'analyse des correspondances}, Bordas, Paris. 1--620.\cr

Greenacre, M. J. (1984) \emph{Theory and applications of correspondence analysis}, Academic Press, London.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(rpjdl)
chisq.test(rpjdl$fau)$statistic
rpjdl.coa <- dudi.coa(rpjdl$fau, scannf = FALSE, nf = 4)
sum(rpjdl.coa$eig)*rpjdl.coa$N # the same

par(mfrow = c(1,2))
s.label(rpjdl.coa$co, clab = 0.6, lab = rpjdl$frlab)
s.label(rpjdl.coa$li, clab = 0.6)
par(mfrow = c(1,1))

data(bordeaux)
db <- dudi.coa(bordeaux, scan = FALSE)
db
score(db)
}
\keyword{multivariate}

\eof
\name{dudi.dec}
\alias{dudi.dec}
\title{Decentred Correspondence Analysis}
\description{
performs a decentred correspondence analysis. 
}
\usage{
dudi.dec(df, eff, scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame containing positive or null values}
  \item{eff}{a vector containing the reference distribution. Its length is equal to the number of rows of df}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
Returns a list of class \code{dec} and \code{dudi} (see \code{\link{dudi}}) containing also 
  \item{R}{sum of all the values of the initial table}
}
\references{Dolédec, S., Chessel, D. and Olivier J. M. (1995) L'analyse des correspondances décentrée: 
application aux peuplements ichtyologiques du haut-Rhône. 
\emph{Bulletin Français de la Pêche et de la Pisciculture}, \bold{336}, 29--40.}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(ichtyo)
dudi1 <- dudi.dec(ichtyo$tab, ichtyo$eff, scan = FALSE)
sum(apply(ichtyo$tab, 2, function(x)
    chisq.test(x, p = ichtyo$eff/sum(ichtyo$eff))$statistic))
sum(dudi1$eig) * sum(ichtyo$eff) # the same

s.class(dudi1$li, ichtyo$dat, wt = ichtyo$eff/sum(ichtyo$eff))
}
\keyword{multivariate}

\eof
\name{dudi.fca}
\alias{dudi.fca}
\alias{prep.fuzzy.var}
\title{Fuzzy Correspondence Analysis}
\description{
 This function analyses a table of fuzzy variables.\cr\cr
 A fuzzy variable takes values of type \eqn{a=(a_1,\dots,a_k)}{a=(a1,\dots,ak)} 
 giving the importance of k categories.\cr\cr
 A missing data is denoted (0,...,0).\cr
 Only the profile a/sum(a) is used, and missing data are replaced by
 the mean profile of the others in the function \code{prep.fuzzy.var}. See ref. for details.
}
\usage{
prep.fuzzy.var (df, col.blocks, row.w = rep(1, nrow(df)))
dudi.fca(df, scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame containing positive or null values}
  \item{col.blocks}{a vector containing the number of categories for each fuzzy variable}
  \item{row.w}{a vector of row weights}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
The function \code{prep.fuzzy.var} returns a data frame with the attribute \code{col.blocks}. 
The function \code{dudi.fca} returns a list of class \code{fca} and \code{dudi} (see \link{dudi}) containing also
\item{cr}{a data frame which rows are the blocs, columns are the kept axes, and values are the correlation ratios.}
}
\references{Chevenet, F., Dolédec, S. and Chessel, D. (1994) A fuzzy coding approach for the analysis of 
long-term ecological data. \emph{Freshwater Biology}, \bold{31}, 295--309. 
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
w1 <- matrix(c(1,0,0,2,1,1,0,2,2,0,1,0,1,1,1,0,1,3,1,0), 4, 5)
w1 <- data.frame(w1)
w2 <- prep.fuzzy.var(w1, c(2,3))
w1
w2
attributes(w2)

data(bsetal97)
w <- prep.fuzzy.var(bsetal97$biol, bsetal97$biol.blo)
scatter(dudi.fca(w, scann = FALSE, nf = 3), csub = 3, clab.moda = 1.5)

w1 <- prep.fuzzy.var(bsetal97$biol, bsetal97$biol.blo)
w2 <- prep.fuzzy.var(bsetal97$ecol, bsetal97$ecol.blo)
d1 <- dudi.fca(w1, scann = FALSE, nf = 3)
d2 <- dudi.fca(w2, scann = FALSE, nf = 3)
plot(coinertia(d1, d2, scann = FALSE))
}
\keyword{multivariate}

\eof
\name{dudi.hillsmith}
\alias{dudi.hillsmith}

\title{ Ordination of Tables mixing quantitative variables and factors }
\description{ performs a multivariate analysis with mixed quantitative variables and factors.}
\usage{dudi.hillsmith(df, row.w = rep(1, nrow(df))/nrow(df), 
   scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{ a data frame with mixed type variables (quantitative and factor) }
  \item{row.w}{ a vector of row weights, by default uniform row weights are used }
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\details{
If \code{df} contains only quantitative variables, this is equivalent to a normed PCA.\cr
If \code{df} contains only factors, this is equivalent to an MCA.\cr

This analysis is the Hill and Smith method and is very similar to \code{dudi.mix} function. 
The differences are that \code{dudi.hillsmith} allow to use various row weights, while
\code{dudi.mix} deals with ordered variables.\cr
The principal components of this analysis are centered and normed vectors maximizing the sum of :\cr
    squared correlation coefficients with quantitative variables\cr
    correlation ratios with factors\cr
}
\value{
Returns a list of class \code{mix} and \code{dudi} (see \link{dudi}) containing also 
  \item{index}{a factor giving the type of each variable : f = factor, q = quantitative}
  \item{assign}{a factor indicating the initial variable for each column of the transformed table}
  \item{cr}{a data frame giving for each variable and each score:\cr
    the squared correlation coefficients if it is a quantitative variable\cr
    the correlation ratios if it is a factor
    }
}
}
\references{ Hill, M. O., and A. J. E. Smith. 1976. Principal component analysis of taxonomic data with multi-state discrete characters. 
\emph{Taxon}, \bold{25}:249-255. }
\author{ Stephane Dray \email{dray@biomserv.univ-lyon1.fr}}

\seealso{ \code{dudi.mix}}
\examples{
   data(dunedata)
   attributes(dunedata$envir$use)$class <- "factor"   # use dudi.mix for ordered data
   dd1 <- dudi.hillsmith(dunedata$envir, scann = FALSE)
   scatter.dudi(dd1, clab.r = 1, clab.c = 1.5)
  }
}

\keyword{multivariate}

\eof
\name{dudi.mix}
\alias{dudi.mix}
\title{Ordination of Tables mixing quantitative variables and factors}
\description{
performs a multivariate analysis with mixed quantitative variables and factors. 
}
\usage{
dudi.mix(df, add.square = FALSE, scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame with mixed type variables (quantitative, factor and ordered)}
  \item{add.square}{a logical value indicating whether the squares of quantitative variables should be added}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\details{
If df contains only quantitative variables, this is equivalent to a normed PCA.\cr
If df contains only factors, this is equivalent to a MCA.\cr
Ordered factors are replaced by \code{poly(x,deg=2)}. \cr

This analysis generalizes the Hill and Smith method.\cr
The principal components of this analysis are centered and normed vectors maximizing the sum of the:\cr
    squared correlation coefficients with quantitative variables\cr
    squared multiple correlation coefficients with polynoms\cr
    correlation ratios with factors. \cr
}
\value{
Returns a list of class \code{mix} and \code{dudi} (see \link{dudi}) containing also 
  \item{index}{a factor giving the type of each variable : f = factor, o = ordered, q = quantitative}
  \item{assign}{a factor indicating the initial variable for each column of the transformed table}
  \item{cr}{a data frame giving for each variable and each score:\cr
    the squared correlation coefficients if it is a quantitative variable\cr
    the correlation ratios if it is a factor\cr
    the squared multiple correlation coefficients if it is ordered}
}
\references{Hill, M. O., and A. J. E. Smith. 1976. Principal component analysis of taxonomic data with multi-state discrete characters. \emph{Taxon}, \bold{25}, 249-255.\cr\cr
De Leeuw, J., J. van Rijckevorsel, and . 1980. HOMALS and PRINCALS - Some generalizations of principal components analysis. Pages 231-242 in E. Diday and Coll., editors. Data Analysis and Informatics II. Elsevier Science Publisher, North Holland, Amsterdam.\cr\cr
Kiers, H. A. L. 1994. Simple structure in component analysis techniques for mixtures of qualitative ans quantitative variables. \emph{Psychometrika}, \bold{56}, 197-212.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(dunedata)
dd1 <- dudi.mix(dunedata$envir, scann = FALSE)
scatter.dudi(dd1, clab.r = 1, clab.c = 1.5)

dd2 <- dudi.mix(dunedata$envir, scann = FALSE, add = TRUE)
scatter.dudi(dd2, clab.r = 1, clab.c = 1.5)
}
\keyword{multivariate}

\eof
\name{dudi.nsc}
\alias{dudi.nsc}
\title{Non symmetric correspondence analysis}
\description{
performs a non symmetric correspondence analysis. 
}
\usage{
dudi.nsc(df, scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame containing positive or null values}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
Returns a list of class \code{nsc} and \code{dudi} (see \code{\link{dudi}}) containing also
  \item{N}{sum of the values of the initial table}
}
\references{Kroonenberg, P. M., and Lombardo  R. (1999) Nonsymmetric correspondence analysis: 
a tool for analysing contingency tables with a dependence structure. \emph{Multivariate Behavioral Research}, \bold{34}, 367--396.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(housetasks)
nsc1 <- dudi.nsc(housetasks, scan = FALSE)
s.label(nsc1$c1, clab = 1.25)
s.arrow(nsc1$li, add.pl = TRUE, clab = 0.75) # see ref p.383
}
\keyword{multivariate}

\eof
\name{dudi.pca}
\alias{dudi.pca}
\title{Principal Component Analysis}
\description{
\code{dudi.pca} performs a principal component analysis of a data frame and
returns the results as objects of class \code{pca} and \code{dudi}. 
}
\usage{
dudi.pca(df, row.w = rep(1, nrow(df))/nrow(df), 
    col.w = rep(1, ncol(df)), center = TRUE, scale = TRUE, 
    scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame with n rows (individuals) and p columns (numeric variables)}
  \item{row.w}{an optional row weights (by default, uniform row weights)}
  \item{col.w}{an optional column weights (by default, unit column weights)}
  \item{center}{a logical or numeric value, centring option\cr
    if TRUE, centring by the mean\cr
    if FALSE no centring\cr
    if a numeric vector, its length must be equal to the number of columns of df (p)
    and gives the decentring}
  \item{scale}{a logical value indicating whether the column vectors should be normed for the row.w weighting}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
Returns a list of classes \code{pca} and \code{dudi} (see \link{dudi}) containing also :
\item{cent}{a vector with p components}
\item{norm}{a vector with p components}
if \eqn{x_{ij}}{x[i,j]} is the value of the table df and \eqn{y_{ij}}{y[i,j]} is the value of the table \code{$tab}, we have:
    \deqn{y_{ij}=\frac{x_{ij}-cent_j}{norm_j}}{y[i,j] = (x[i,j] - cent[j]) / norm[j]}
    \deqn{x_{ij}=y_{ij} \ast norm_j + cent_j}{x[i,j] = y[i,j]*norm[j] + cent[j]}
}
\seealso{
    \code{prcomp}, \code{princomp} in the \code{mva} library
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(deug)
deug.dudi <- dudi.pca(deug$tab, center = deug$cent, 
    scale = FALSE, scan = FALSE)
par(mfrow = c(2,2))
s.class(deug.dudi$li, deug$result, cpoint = 1)
s.arrow(deug.dudi$c1, lab = names(deug$tab))
deug.dudi1 <- dudi.pca(deug$tab, center = TRUE, 
    scale = TRUE, scan = FALSE)
s.class(deug.dudi1$li, deug$result, cpoint = 1)
s.corcircle(deug.dudi1$co, lab = names(deug$tab), 
    full = FALSE, box = TRUE)
par(mfrow = c(1,1))

# for interpretations
par(mfrow = c(3,3))
par(mar = c(2.1,2.1,2.1,1.1))
for(i in 1:9) { 
hist(deug.dudi$tab[,i], xlim = c(-40,40), breaks = seq(-45, 35, by = 5), 
    prob = TRUE, right = FALSE, main = names(deug$tab)[i], xlab = "", 
    ylim = c(0,0.10))
abline(v = 0, lwd = 3)
}
par(mfrow = c(1,1))
}
\keyword{multivariate}

\eof
\name{dudi.pco}
\alias{dudi.pco}
\alias{scatter.pco}
\title{Principal Coordinates Analysis}
\description{
\code{dudi.pco} performs a principal coordinates analysis of a Euclidean distance matrix
and returns the results as objects of class \code{pco} and \code{dudi}. 
}
\usage{
dudi.pco(d, row.w = "uniform", scannf = TRUE, nf = 2, 
    full = FALSE, tol = 1e-07)
scatter.pco (x, xax = 1, yax = 2, clab.row = 1, posieig = "top", 
    sub = NULL, csub = 2, \dots) 
}
\arguments{
  \item{d}{an object of class 'dist' containing an Euclidean distance matrix.}
  \item{row.w}{an optional distance matrix row weights. 
  If not null, must be a vector of positive numbers with length equal to the size of the distance matrix}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \item{full}{a logical value indicating whether all the axes should be kept}
  \item{tol}{a tolerance threshold to test whether the distance matrix is Euclidean :
    an eigenvalue is considered positive if it is larger than 
  \code{-tol*lambda1} where \code{lambda1} is the largest eigenvalue.}\cr\cr
      
  \item{x}{an object of class \code{pco}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{clab.row}{a character size for the row labels}
  \item{posieig}{if "top" the eigenvalues bar plot is upside,
    if "bottom" it is downside, if "none" no plot}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
\code{dudi.pco} returns a list of class \code{pco} and \code{dudi}. See \code{\link{dudi}}
}
\references{Gower, J. C. (1966) Some distance properties of latent root and vector methods used in multivariate analysis. \emph{Biometrika}, \bold{53}, 325--338.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(yanomama)
gen <- quasieuclid(as.dist(yanomama$gen))
geo <- quasieuclid(as.dist(yanomama$geo))
ant <- quasieuclid(as.dist(yanomama$ant))
geo1 <- dudi.pco(geo, scann = FALSE, nf = 3)
gen1 <- dudi.pco(gen, scann = FALSE, nf = 3)
ant1 <- dudi.pco(ant, scann = FALSE, nf = 3)
plot(coinertia(ant1, gen1, scann = FALSE))
}
\keyword{array}
\keyword{multivariate}

\eof
\name{dunedata}
\alias{dunedata}
\non_function{}
\title{Dune Meadow Data}
\description{
\code{dunedata} is a data set containing for 30 sites, environmental variables and plant species. 
}
\usage{data(dunedata)}
\format{
    \code{dunedata} is a list with 2 components.
    \describe{
        \item{envir}{is a data frame with 30 rows (sites) 5 columns (environnemental variables).}
        \item{veg}{is a data frame with 30 rows (sites) 20 columns (plant species).}
    }
}
\source{
 Jongman, R. H., ter Braak, C. J. F.  and van Tongeren, O. F. R.  (1987)
 \emph{Data analysis in community and landscape ecology}, Pudoc, Wageningen.
}
\examples{
data(dunedata)
summary(dunedata$envir)
is.ordered(dunedata$envir$use)
score(dudi.mix(dunedata$envir, scan = FALSE))
}
\keyword{datasets}

\eof
\name{ecg}
\alias{ecg}
\docType{data}
\title{Electrocardiogram data}
\description{
These data were measured during the normal sinus rhythm of a patient who occasionally experiences arrhythmia. 
There are 2048 observations measured in units of millivolts and collected at a rate of 180 samples per second.
This time series is a good candidate for a multiresolution analysis because its components are on different scales.
For example, the large scale (low frequency) fluctuations, known as baseline drift, are due to the patient respiration,
while the prominent short scale (high frequency) intermittent fluctuations between 3 and 4 seconds are evidently due to patient movement.
Heart rhythm determines most of the remaining features in the series. 
The large spikes occurring about 0.7 seconds apart the R waves of normal heart rhythm;
the smaller, but sharp peak coming just prior to an R wave is known as a P wave;
and the broader peak that comes after a R wave is a T wave.
}
\usage{data(ecg)}
\format{
A vector of class \code{ts} containing 2048 observations.
}
\source{
Gust Bardy and Per Reinhall, University of Washington
}
\references{
Percival, D. B., and Walden, A.T. (2000) \emph{Wavelet Methods for Time Series Analysis}, Cambridge University Press.
}
\examples{
\dontrun{
# figure 130 in Percival and Walden (2000)
if (require(waveslim) == TRUE) { 
data(ecg)
ecg.level <- haar2level(ecg)
ecg.haar <- orthobasis.haar(length(ecg))
ecg.mld <- mld(ecg, ecg.haar, ecg.level, plot = FALSE)
res <- cbind.data.frame(apply(ecg.mld[,1:5],1,sum), ecg.mld[,6:11])
par(mfrow = c(8,1))
par(mar = c(2, 5, 1.5, 0.6))
plot(as.ts(ecg), ylab = "ECG")
apply(res, 2, function(x) plot(as.ts(x), ylim = range(res),
 ylab = ""))
par(mfrow = c(1,1))
}}
}
\keyword{datasets}

\eof
\name{ecomor}
\alias{ecomor}
\docType{data}
\title{Ecomorphological Convergence}
\description{
This data set gives ecomorphological informations about 129 bird species. 
}
\usage{data(ecomor)}
\format{
    \code{ecomor} is a list of 7 components.
\describe{
        \item{forsub}{is a data frame with 129 species, 6 variables (the feeding place classes): 
        foliage, ground , twig , bush, trunk and aerial feeders. These dummy variables indicate the use (1) 
        or  no use (0) of a given feeding place by a species. }
        \item{diet}{is a data frame with 129 species and 8 variables (diet types): Gr (granivorous: seeds), 
        Fr (frugivorous: berries, acorns, drupes), Ne (frugivorous: nectar), Fo (folivorous: leaves), 
        In (invertebrate feeder: insects, spiders, myriapods, isopods, snails, worms), 
        Ca (carnivorous: flesh of small vertebrates), Li (limnivorous: invertebrates in fresh water),
        and Ch (carrion feeder). These dummy variables indicate the use (1) 
        or  no use (0) of a given diet type by a species.}
        \item{habitat}{is a data frame with 129 species, 16 dummy variables (the habitats). 
        These variables indicate the species presence (1) or the species absence (0) in a given habitat.}
        \item{morpho}{is a data frame with 129 species abd 8 morphological variables: wingl (Wing length, mm), 
        taill (Tail length, mm), culml (Culmen length, mm), bilh (Bill height, mm), bilw (Bill width, mm), 
        tarsl (Tarsus length, mm), midtl (Middle toe length, mm) and weig (Weight, g).}
        \item{taxo}{is a data frame with 129 species and 3 factors: Genus, Family and Order.
        It is a data frame of class \code{'taxo'}: the variables are factors giving nested classifications.}
        \item{labels}{is a data frame with vectors of the names of species (complete and in abbreviated form.}
        \item{categ}{is a data frame with 129 species, 2 factors : 'forsub' summarizing the feeding place and 
        'diet' the diet type.}
}}
\source{
Blondel, J., Vuilleumier, F., Marcus, L.F., and Terouanne, E. (1984). Is there ecomorphological convergence 
among mediterranean bird communities of Chile, California, and France. In \emph{Evolutionary Biology} 
(eds M.K. Hecht, B. Wallace and R.J. MacIntyre), 141--213, \bold{18}. Plenum Press, New York.
}
\examples{
data(ecomor)
ric <- apply(ecomor$habitat, 2, sum)
s.corcircle(dudi.pca(log(ecomor$morpho), scan = FALSE)$co)

forsub <- data.frame(t(apply(ecomor$forsub, 1,
     function (x) x/sum(x))))
pca1 <- dudi.pca(forsub, scan = FALSE, scale = FALSE)
s.arrow(pca1$c1)
w <- as.matrix(forsub)%*%as.matrix(pca1$c1)
s.label(w, clab = 0, add.p = TRUE, cpoi = 2)

diet <- data.frame(t(apply(ecomor$diet, 1,
     function (x) x/sum(x))))
pca2 <- dudi.pca(diet, scan = FALSE, scale = FALSE)
s.arrow(pca2$c1)
w <- as.matrix(diet)%*%as.matrix(pca2$c1)
s.label(w, clab = 0, add.p = TRUE, cpoi = 2)
\dontrun{
dmorpho <- dist.quant(log(ecomor$morpho), 3)
dhabitat <- dist.binary(ecomor$habitat, 1)

mantel.randtest(dmorpho, dhabitat)
RV.rtest(pcoscaled(dmorpho), pcoscaled(dhabitat), 999)
procuste.randtest(pcoscaled(dmorpho), pcoscaled(dhabitat))

ecophy <- taxo2phylog(ecomor$taxo)
table.phylog(ecomor$habitat, ecophy, clabel.n = 0.5, f = 0.6,
     clabel.c = 0.75, clabel.r = 0.5, csi = 0.75, cleg = 0)
plot.phylog(ecophy, clabel.n = 0.75, clabel.l = 0.75,
     labels.l = ecomor$labels[,"latin"])
dtaxo <- ecophy$Wdist
mantel.randtest(dmorpho, dtaxo)
mantel.randtest(dhabitat, dtaxo)
}}
\keyword{datasets}

\eof
\name{elec88}
\alias{elec88}
\docType{data}
\title{Electoral Data}
\description{
This data set gives the results of the presidential election in France in 1988 for each department and all the candidates. 
}
\usage{data(elec88)}
\format{
\code{elec88} is a list of 7 components. 
\describe{
    \item{tab}{is a data frame with 94 rows (departments) and 9 variables (candidates)}
    \item{res}{is the global result of the election all-over the country.}
    \item{lab}{is the vector of the names of the 94 french departments.}
    \item{area}{is the dataframe of 3 variables returning the boundary lines of each department. 
    The first variable is a factor. The levels of this one are the row.names of tab. 
    The second and third variables return the coordinates (x,y) of the points of the boundary line.}
    \item{contour}{is a data frame with 4 variables (x1,y1,x2,y2)for the contour display of France}
    \item{xy}{is a data frame with two variables (x,y) giving the position of the center for each department}
    \item{neig}{is the neighbouring graph between departments, object of the class \code{neig}}
    }
}
\source{
 Public data
}
\examples{
data(elec88)
apply(elec88$tab, 2, mean)
summary(elec88$res)

par(mfrow = c(2,2))
plot(elec88$area[,2:3], type = "n", asp = 1)
lpoly <- split(elec88$area[,2:3], elec88$area[,1])
lapply(lpoly, function(x) {points (x,type = "l");invisible()})
polygon(elec88$area[elec88$area$V1=="D25", 2:3], col = 1)
area.plot(elec88$area, graph = elec88$neig, lwdg = 1)
polygon(elec88$area[elec88$area$V1=="D25", 2:3], col = 1)
pca1 <- dudi.pca(elec88$tab, scal = FALSE, scan = FALSE)
area.plot(elec88$area, val = elec88$xy[,1] + elec88$xy[,2])
area.plot(elec88$area, val = pca1$li[,1], sub = "F1 PCA", 
    csub = 2, cleg = 1.5)
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{escopage}
\alias{escopage}
\docType{data}
\title{K-tables of wine-tasting}
\description{
This data set describes 27 characteristics of 21 wines distributed in four fields : 
rest, visual, olfactory and global. 
}
\usage{data(escopage)}
\format{
    \code{escopage} is a list of 3 components.
    \describe{
        \item{tab}{is a data frame with 21 observations (wines) and 27 variables. }
        \item{tab.names}{is the vector of the names of sub-tables : "rest" "visual" "olfactory" "global".}
        \item{blo}{is a vector of the numbers of variables for each sub-table.}
    }
}
\source{
Escofier, B. and Pagès, J. (1990) 
\emph{Analyses factorielles simples et multiples : objectifs, méthodes et interprétation} 
Dunod, Paris. 1--267.

Escofier, B. and Pagès, J. (1994) 
Multiple factor analysis (AFMULT package). 
\emph{Computational Statistics and Data Analysis}, \bold{18}, 121--140.
}
\examples{
data(escopage)
w <- data.frame(scale(escopage$tab))
w <- ktab.data.frame(w, escopage$blo)
names(w)[1:4] <- escopage$tab.names
plot(mfa(w, scan = FALSE))
}
\keyword{datasets}

\eof
\name{euro123}
\alias{euro123}
\docType{data}
\title{Triangular Data}
\description{
This data set gives the proportions of employement in the primary, secondary and tertiary 
sectors for 12 European countries in 1978, 1986 and 1997. 
}
\usage{data(euro123)}
\format{
    \code{euro123} is a list of 4 components.
    \describe{
    \item{in78}{is a data frame with 12 rows and 3 variables.}
    \item{in86}{: idem in 1986}
    \item{in97}{: idem in 1997}
    \item{plan}{is a data frame with two factors to both organize the 3 tables.}
    }
}
\source{
Encyclopaedia Universalis, Symposium, Les chiffres du Monde. Encyclopaedia Universalis, Paris. 519.\cr\cr
Université de Barcelone : \url{http://www.ub.es/medame/nutstat1.html}
}
\examples{
data(euro123)
par(mfrow = c(2,2))
triangle.plot(euro123$in78, addaxes = TRUE)
triangle.plot(euro123$in86, addaxes = TRUE)
triangle.plot(euro123$in97, addaxes = TRUE)
triangle.biplot(euro123$in78, euro123$in97)
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{fission}
\alias{fission}
\docType{data}
\title{Fission pattern and heritable morphological traits}
\description{
This data set contains the mean values of five highly heritable linear combinations of cranial metric (GM1-GM3) and non metric (GN1-GN2) for 8 social groups of Rhesus Macaques on Cayo Santiago. It also describes the fission tree depicting the historical phyletic relationships.
}
\usage{data(fission)}
\format{
\code{fission} is a list containing the 2 following objects : 
\describe{   
   \item{tre}{is a character string giving the fission tree in Newick format.} 
   \item{tab}{is a data frame with 8 social groups and five traits : cranial metrics (GM1, GM2, GM3) and
               cranial non metrics (GN1, GN2)}}  
}
\references{
Cheverud, J. and Dow, M.M. (1985) An autocorrelation analysis of genetic variation due to lineal fission in social groups of rhesus macaques. 
\emph{American Journal of Physical Anthropology}, \bold{67}, 113--122.
}
\examples{
data(fission)
fis.phy <- newick2phylog(fission$tre)
table.phylog(fission$tab[names(fis.phy$leaves),], fis.phy, csi = 2)
gearymoran(fis.phy$Amat, fission$tab)
}
\keyword{datasets}

\eof
\name{foucart}
\alias{foucart}
\alias{plot.foucart}
\alias{print.foucart}
\title{K-tables Correspondence Analysis with the same rows and the same columns}
\description{
  K tables have the same rows and the same columns.\cr
  Each table is transformed by P = X/sum(X). The average of P is computing.\cr
  A correspondence analysis is realized on this average.\cr
  The initial rows and the initial columns are projected in supplementary elements.
}
\usage{
foucart(X, scannf = TRUE, nf = 2)
plot.foucart(x, xax = 1, yax = 2, clab = 1, csub = 2, possub = "bottomright", \dots) 
print.foucart(x, \dots) 
}
\arguments{
  \item{X}{a list of data frame where the row names and the column names are the same for each table}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \cr
  \item{x}{an object of class 'foucart'}
  \item{xax}{the column number of the x-axis}
  \item{yax}{the column number of the y-axis}
  \item{clab}{if not NULL, a character size for the labels, used with \code{par("cex")*clab}}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{\dots}{further arguments passed to or from other methods}

}
\value{
  \code{foucart} returns a list of the classes 'dudi', 'coa' and 'foucart'
    \item{call}{origine}
    \item{nf}{axes-components saved}
    \item{rank}{rank}
    \item{blo}{useful vector}
    \item{cw}{vector: column weights}
    \item{lw}{vector: row weights}
    \item{eig}{vector: eigen values}
    \item{tab}{data.frame: modified array}
    \item{li}{data.frame: row coordinates}
    \item{l1}{data.frame: row normed scores}
    \item{co}{data.frame: column coordinates}
    \item{c1}{data.frame: column normed scores}
    \item{Tli}{data.frame: row coordinates (each table)}
    \item{Tco}{data.frame: col coordinates (each table)}
    \item{TL}{data.frame: factors for Tli}
    \item{TC}{data.frame: factors for Tco}
}
\references{Foucart, T. (1984) \emph{Analyse factorielle de tableaux multiples}, Masson, Paris.
}
\author{P. Bady
}
\examples{
data(bf88)
fou1 <- foucart(bf88, scann = FALSE, nf = 3)
fou1
plot(fou1)

data(meaudret)
l1 <- split(meaudret$fau, meaudret$plan$dat)
l1 <- lapply(l1, function(x) 
    {row.names(x) <- paste("Sta",1:5,sep="");x})
fou2 <- foucart(l1, scan = FALSE)
kplot(fou2, clab.r = 2)
}
\keyword{multivariate}

\eof
\name{friday87}
\alias{friday87}
\docType{data}
\title{Faunistic K-tables}
\description{
This data set gives informations about sites, species and environmental variables.
}
\usage{data(friday87)}
\format{
    \code{friday87} is a list of 4 components.
    \describe{
    \item{fau}{is a data frame containing a faunistic table with 16 sites and 91 species.}
    \item{mil}{is a data frame with 16 sites and 9 environmental variables.}
    \item{fau.blo}{is a vector of the number of species per group.}
    \item{tab.names}{is the name of each group of species.}
    }
}
\source{
Friday, L.E. (1987) The diversity of macroinvertebrate and macrophyte communities in ponds, \emph{Freshwater Biology}, \bold{18}, 87--104.
}
\examples{
data(friday87)
wfri <- data.frame(scale(friday87$fau, scal = FALSE))
wfri <- ktab.data.frame(wfri, friday87$fau.blo, 
    tabnames = friday87$tab.names)
kplot(sepan(wfri), clab.r = 2, clab.c = 1)
}
\keyword{datasets}

\eof
\name{fruits}
\alias{fruits}
\docType{data}
\title{Pair of Tables}
\description{
    28 batches of fruits -two types- are judged by two different ways.\cr
    They are classified in order of preference, without ex aequo, by 16 individuals.\cr
    15 quantitative variables described the batches of fruits.\cr
}
\usage{data(fruits)}
\format{
    \code{fruits} is a list of 3 components:
    \describe{
    \item{typ}{is a vector returning the type of the 28 batches of fruits (peaches or nectarines).}
    \item{jug}{is a data frame of 28 rows et 16 columns (judges).}
    \item{var}{is a data frame of 28 rows et 16 measures (average of 2 judgements).}
    }
}
\details{
    \code{fruits$var} is a data frame of 15 variables:
    \enumerate{
    \item{1{\_}taches}{: quantity of cork blemishes (0=absent - maximum 5)}
    \item{2{\_}stries}{: quantity of stria (1/none - maximum 4)}
    \item{3{\_}ab{\_}muc}{: abundance of mucron (1/absent - 4)}
    \item{4{\_}ir{\_}for}{: shape irregularity (0/none - 3)}
    \item{5{\_}allong}{: length of the fruit (1/round fruit - 4)}
    \item{6{\_}su{\_}rou}{: percentage of the red surface (minimum 40\% - maximum 90\%)}
    \item{7{\_}ho{\_}lot}{: homogeneity of the intra-batch coloring (1/strong - 4)}
    \item{8{\_}ho{\_}fru}{: homogeneity of the intra-fruit coloring (1/strong - 4)}
    \item{9{\_}pubes}{: pubescence (0/none - 4)}
    \item{10{\_}vert}{: intensity of green in red area (1/none - 4)}
    \item{11{\_}fonc}{: intensity of dark area (0/pink - 4)}
    \item{12{\_}col{\_}mu}{: intensity of the mucron color (1=no contrast - 4/dark)}
    \item{13{\_}impres}{: kind of impression (1/watched - 4/pointillé)}
    \item{14{\_}col{\_}dom}{: intensity of the predominating color (0/clear - 4)}
    \item{15{\_}calib}{: grade (1/<90g - 5/>200g)}
    }
}
\source{
Kervella, J. (1991) 
Analyse de l'attrait d'un produit : exemple d'une comparaison de lots de pêches. 
Agro-Industrie et méthodes statistiques. 
Compte-rendu des secondes journées européennes. Nantes 13-14 juin 1991.  
Association pour la Statistique et ses Utilisations, Paris,  313--325.
}
\examples{
data(fruits)
par(mfrow = c(2,2))
pcajug <- dudi.pca(fruits$jug, scann = FALSE)
s.corcircle(pcajug$co)
s.class(pcajug$li, fac = fruits$type)

pcavar <- dudi.pca(fruits$var, scann = FALSE)
s.corcircle(pcavar$co)
s.class(pcavar$li, fac = fruits$type)

par(mfrow = c(1,1))
plot(coinertia(pcajug, pcavar, scan = FALSE))
}
\keyword{datasets}

\eof
\name{gearymoran}
\alias{gearymoran}
\title{Moran's I and Geary'c randomization tests for spatial and phylogenetic autocorrelation}
\description{
This function performs Moran's I test using phylogenetic and spatial link matrix (binary or general). It uses neighbouring weights so Moran's I and Geary's c randomization tests are equivalent.
}
\usage{
gearymoran(bilis, X, nrepet = 999)
}
\arguments{
  \item{bilis}{: a \emph{n} by \emph{n} link matrix where \emph{n} is the row number of X}
  \item{X}{: a data frame with continuous variables}
  \item{nrepet}{: number of random vectors for the randomization test}
}
\details{
\code{bilis} is a squared symmetric matrix which terms are all positive or null. 

\code{bilis} is firstly transformed in frequency matrix A by dividing it by the total sum of data matrix :  
\deqn{a_{ij} = \frac{bilis_{ij}}{\sum_{i=1}^{n}\sum_{j=1}^{n}bilis_{ij}}}{a_ij = bilis_ij / (sum_i sum_j bilis_ij)}. 
The neighbouring weights is defined by the matrix \eqn{D = diag(d_1,d_2, \ldots)} where \eqn{d_i = \sum_{j=1}^{n}bilis_{ij}}{d_i = sum_j bilis_ij}.
For each vector x of the data frame X, the test is based on the Moran statistic \eqn{x^{t}Ax}{t(x)Ax} where x is D-centred. 
}
\value{
Returns an object of class \code{krandtest} (randomization tests).
}
\references{
Cliff, A. D. and Ord, J. K. (1973) \emph{Spatial autocorrelation}, Pion, London.

Thioulouse, J., Chessel, D. and Champely, S. (1995) Multivariate analysis of spatial patterns: a unified approach to local and global structures. 
\emph{Environmental and Ecological Statistics}, \bold{2}, 1--14.
}
\author{Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr} \cr
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link[spdep]{moran.test}} and \code{\link[spdep]{geary.test}} for classical versions of Moran'I test and Geary'c one}
\examples{
# a spatial example
data(mafragh)
tab0 <- (as.data.frame(scalewt(mafragh$mil)))
bilis0 <- neig2mat(mafragh$neig)
gm0 <- gearymoran(bilis0, tab0, 999)
gm0
plot(gm0, nclass = 20)

\dontrun{
# a phylogenetic example
data(mjrochet)
mjr.phy <- newick2phylog(mjrochet$tre)
mjr.tab <- log(mjrochet$tab)
gearymoran(mjr.phy$Amat, mjr.tab)
gearymoran(mjr.phy$Wmat, mjr.tab)
par(mfrow = c(1,2))
table.value(mjr.phy$Wmat, csi = 0.25, clabel.r = 0)
table.value(mjr.phy$Amat, csi = 0.35, clabel.r = 0)
par(mfrow = c(1,1))
}}
\keyword{spatial}
\keyword{ts}

\eof
\name{genet}
\alias{genet}
\alias{char2genet}
\alias{count2genet}
\alias{freq2genet}
\title{A class of data: tables of populations and alleles}
\description{
There are multiple formats of genetic data.  The functions of ade4 associated genetic data use the class \code{genet}.
An object of the class \code{genet} is a list containing at least one data frame whose lines are groups of individuals (populations) and columns alleles forming blocks associated with the locus.
They contain allelic frequencies expressed as a percentage. \cr
The function \code{char2genet} ensures the reading of tables crossing diploid individuals arranged by groups (populations) and polymorphic loci. Data frames containing only strings of characters are transformed in tables of allelic frequencies of the class \code{genet}. 
In entry a row is an individual, a variable is a locus and a value is a string of characters, for example ' 012028 ' for a heterozygote carrying alleles 012 and 028, ' 020020 ' for a homozygote carrying two alleles 020 and ' 000000 ' for a not classified locus (missing data). \cr
The function \code{count2genet} reads data frames containing allelic countings by populations and allelic forms classified by locus.\cr 
The function \code{freq2genet} reads data frames containing allelic frequencies by populations and allelic forms classified by locus. \cr
In these two cases, use as names of variables of strings of characters \code{xx.yyy} where \code{xx} are the names of locus and \code{yyy} a name of allelic forms in this locus.
The analyses on this kind of data having to use compact labels, these functions classify the names of the populations, the names of the loci and the names of the allelic forms in vectors and re-code in a simple way starting with P for population, L for locus and 1,\dots, m  for the alleles.  
}
\usage{
char2genet(X, pop, complete)
count2genet(PopAllCount)
freq2genet(PopAllFreq)
}
\arguments{
  \item{X}{a data frame of strings of characters (individuals in row, locus in variables), the value coded '000000' or two alleles of 6 characters}
  \item{pop}{a factor with the same number of rows than \code{df} classifying the individuals by population}
  \item{complete}{a logical value indicating a complete issue or not, by default FALSE}
  \item{PopAllCount}{a data frame containing integers: the occurrences of each allelic form (column) in each population (row)}
  \item{PopAllFreq}{a data frame containing values between 0 and 1: the frequencies of each allelic form (column) in each population (row)}
}
\value{
\code{char2genet} returns a list of class \code{genet} with :
\item{$tab}{a frequencies table of poplations (row) and alleles (column) }
\item{$center}{the global frequency of each allelic form calculated on the overall individuals classified on each locus} 
\item{$pop.names}{a vector containing the names of populations present in the data re-coded P01, P02, \dots}}
\item{$all.names}{a vector containing the names of the alleles present in the data re-coded L01.1, L01.2, \dots}
\item{$loc.blocks}{a vector containing the number of alleles by loci}
\item{$loc.fac}{a factor sharing the alleles by loci}
\item{$loc.names}{a vector containing the names of loci present in the data re-coded L01, \dots, L99 }
\item{$pop.loc}{a data frame containing the number of genus allowing the calculation of frequencies}
\item{$comp}{the complete individual typing with the code 02000 or 01001 if the option \code{complete} is TRUE}
\item{$comp.pop}{a factor indicating the population if the option \code{complete} is TRUE}

\code{count2genet} and \code{req2genet} return a list of class \code{genet} which don't contain the components \code{pop.loc} and \code{complete}.
}
\details{
As a lot of formats for genetic data are puublished in literature, a list of class \code{genet} contains at least a table of allellic frequencies and an attribut \code{loc.blocks}. The populations (row) and the variables (column) are classified by alphabetic order.
In the component \code{comp}, each individual per locus of m alleles is re-coded by a vector of length m: for hererozygicy 0,\dots,1,\dots,1,\dots,0 and homozygocy 0,\dots,2,0.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(casitas)
casitas[24,]
casitas.pop <- as.factor(rep(c("dome", "cast", "musc", "casi"), c(24,11,9,30)))
casi.genet <- char2genet(casitas, casitas.pop, complete=TRUE)
names(casi.genet$tab) 
casi.genet$tab[,1:8] 
casi.genet$pop.names
casi.genet$loc.names
casi.genet$all.names
casi.genet$loc.blocks # number of allelic forms by loci
casi.genet$loc.fac # factor classifying the allelic forms by locus
casi.genet$pop.loc # table populations loci
names(casi.genet$comp)
casi.genet$comp[1:4,]
casi.genet$comp.pop
casi.genet$center
apply(casi.genet$tab,2,mean)
casi.genet$pop.loc[,"L15"]
casi.genet$tab[, c("L15.1","L15.2")]
class(casi.genet)
casitas.coa <- dudi.coa(casi.genet$comp, scannf = FALSE)
s.class(casitas.coa$li,casi.genet$comp.pop)
}
\keyword{multivariate}

\eof
\name{granulo}
\alias{granulo}
\docType{data}
\title{Granulometric Curves}
\description{
This data set gives the repartition in diameter classes of deposit samples. 
}
\usage{data(granulo)}
\format{
    \code{granulo} is a list of 2 components.
    \describe{
        \item{tab}{contains the 49 deposit samples, 9 diameter classes, weight of grains by size class}
        \item{born}{contains the boundaries of the diameter classes}
    }
}
\source{
Gaschignard-Fossati, O. (1986) \emph{Répartition spatiale des macroinvertébrés benthiques d'un bras vif du Rhône.
Rôle des crues et dynamique saisonnière.}
Thèse de doctorat, Université Lyon 1.
}
\examples{
data(granulo)
w <- t(apply(granulo$tab, 1, function (x) x / sum(x)))
w <- data.frame(w)
wtr <- data.frame(t(w))
wmoy <- data.frame(matrix(apply(wtr, 1, mean), 1))
d1 <- dudi.pca(w, scal = FALSE, scan = FALSE)
wmoy <- suprow.default(d1, wmoy)$lisup
s.arrow(d1$c1, clab = 1.5)
s.distri(d1$c1, wtr, cstar = 0.33, cell = 0, 
    axesell = FALSE, add.p = TRUE, clab = 0.75)
s.label(wmoy, cpoi = 5, clab = 0, add.p = TRUE)
}
\keyword{datasets}

\eof
\name{gridrowcol}
\alias{gridrowcol}
\title{Complete regular grid analysis}
\description{
This function defines objects to analyse data sets associated with complete regular grid.
}
\usage{
gridrowcol(nrow, ncol, cell.names = NULL)
}
\arguments{
  \item{nrow}{size of the grid (number of rows)}
  \item{ncol}{size of the grid (number of columns)}
  \item{cell.names}{grid cell labels}
}
\value{
Returns a list containing the following items :
    \item{xy}{: a data frame with grid cell coordinates}
    \item{area}{: a data frame with three variables to display grid cells as areas}
    \item{neig}{: an object of class \code{'neig'} corresponding to a neighbouring graph of the grid (rook case)}
    \item{orthobasis}{: an object of class \code{'orthobasis'} corresponding to the analytical solution for the neighbouring graph}
}
\references{
Méot, A., Chessel, D. and Sabatier, D. (1993) Opérateurs de voisinage et analyse des données spatio-temporelles.
\emph{in} J.D. Lebreton and B. Asselain, editors. Biométrie et environnement. Masson, 45-72.

Cornillon, P.A. (1998) \emph{Prise en compte de proximités en analyse factorielle et comparative}. Thèse, Ecole Nationale Supérieure Agronomique, Montpellier.
}
\author{Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr} \cr
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{orthobasis}}, \code{\link{orthogram}}, \code{\link{mld}}}
\examples{
w <- gridrowcol(8,5)
par(mfrow = c(1,2))
area.plot(w$area,center = w$xy, graph = w$neig, clab = 0.75)
area.plot(w$area,center = w$xy, graph = w$neig, clab = 0.75,
 label = as.character(1:40))
par(mfrow = c(1,1))

par(mfrow = c(5,8))
for(k in 1:39)
    s.value(w$xy, w$orthobasis[,k], csi = 3, cleg = 0, csub = 2,
     sub = as.character(signif(attr(w$orthobasis, "values")[k],3)),
      incl = FALSE, addax = FALSE, cgr = 0, ylim = c(0,10))
par(mfrow = c(1,1))
}
\keyword{spatial}

\eof
\name{housetasks}
\alias{housetasks}
\docType{data}
\title{Contingency Table}
\description{
The \code{housetasks} data frame gives 13 housetasks and their repartition in the couple. 
}
\usage{data(housetasks)}
\format{
  This data frame contains four columns : wife, alternating, husband and jointly.
  Each column is a numeric vector. 
}
\source{
Kroonenberg, P. M. and Lombardo, R. (1999)
Nonsymmetric correspondence analysis: a tool for analysing contingency tables with a dependence structure.
\emph{Multivariate Behavioral Research}, \bold{34}, 367--396
}
\examples{
data(housetasks)
nsc1 <- dudi.nsc(housetasks, scan = FALSE)
s.label(nsc1$c1, clab = 1.25)
s.arrow(nsc1$li, add.pl = TRUE, clab = 0.75) 
}
\keyword{datasets}

\eof
\name{humDNAm}
\alias{humDNAm}
\docType{data}
\title{human mitochondrial DNA restriction data}
\description{
This data set gives the frequencies of haplotypes of mitochondrial DNA restriction data in ten populations all over the world.\cr
It gives also distances among the haplotypes. 
}
\usage{data(humDNAm)}
\format{
    \code{humDNAm} is a list of 3 components.
\describe{
    \item{distances}{is an object of class \code{dist} with 56 haplotypes.
    These distances are computed by counting the number of differences in restriction sites between two haplotypes.}
    \item{samples}{is a data frame with 56 haplotypes, 10 abundance variables (populations). 
    These variables give the haplotype abundance in a given population.}
    \item{structures}{is a data frame with 10 populations, 1 variable (classification).
    This variable gives the name of the continent in which a given population is located}
}}
\source{
  Excoffier, L., Smouse, P.E. and Quattro, J.M. (1992) Analysis of molecular variance inferred from metric distances
  among DNA haplotypes: application to human mitochondrial DNA restriction data. \emph{Genetics}, \bold{131}, 479--491.
}
\examples{
data(humDNAm)
dpcoahum <- dpcoa(humDNAm$samples, sqrt(humDNAm$distances), scan = FALSE, nf = 2)
plot(dpcoahum, csize = 1.5)
}
\keyword{datasets}

\eof
\name{ichtyo}
\alias{ichtyo}
\docType{data}
\title{Point sampling of fish community}
\description{
This data set gives informations between a faunistic array, 
the total number of sampling points made at each sampling occasion and 
the year of the sampling occasion. 
}
\usage{data(ichtyo)}
\format{
    \code{ichtyo} is a list of 3 components.
    \describe{
    \item{tab}{is a faunistic array with 9 columns and 32 rows.}
    \item{eff}{is a vector of the 32 sampling effort.}
    \item{dat}{is a factor where the levels are the 10 years of the sampling occasion.}
    }
}
\details{
    The value n(i,j) at the ith row and the jth column in \code{tab} corresponds to the number of sampling
    points of the ith sampling occasion (in \code{eff}) that contains the jth species.
}
\source{
Dolédec, S., Chessel, D. and Olivier, J. M. (1995)
L'analyse des correspondances décentrée: application aux peuplements ichtyologiques du haut-Rhône.
\emph{Bulletin Français de la Pêche et de la Pisciculture}, \bold{336}, 29--40.
}
\examples{
data(ichtyo)
dudi1 <- dudi.dec(ichtyo$tab, ichtyo$eff, scan = FALSE)
s.class(dudi1$li, ichtyo$dat, wt = ichtyo$eff / sum(ichtyo$eff))
}
\keyword{datasets}

\eof
\name{inertia.dudi}
\alias{inertia.dudi}
\title{Statistics of inertia in a one-table analysis}
\description{
Prints of the statistics of inertia in a one-table analysis
}
\usage{
inertia.dudi(dudi, row.inertia = FALSE, col.inertia = FALSE)
}
\arguments{
  \item{dudi}{a duality diagram, object of class \code{dudi}}
  \item{row.inertia}{if TRUE, returns the statistics of the decomposition of inertia for the rows}
  \item{col.inertia}{if TRUE, returns the statistics of the decomposition of inertia for the columns}
}
\value{
a list containing :
\item{TOT}{repartition of the total inertia between axes}
\item{row.abs}{absolute contributions of the decomposition of inertia for the rows}
\item{row.rel}{relative contributions of the decomposition of inertia for the rows}
\item{row.cum}{cumulative relative contributions of the decomposition of inertia for the rows}
\item{col.abs}{absolute contributions of the decomposition of inertia for the columns}
\item{col.rel}{relative contributions of the decomposition of inertia for the columns}
\item{col.cum}{cumulative relative contributions of the decomposition of inertia for the columns}
}
\references{
Lebart, L., Morineau, A. and Tabart, N. (1977) \emph{Techniques de la description statistique, méthodes et logiciels pour la description des grands tableaux}, Dunod, Paris, 61--62.\cr\cr
Volle, M. (1981) \emph{Analyse des données}, Economica, Paris, 89--90 and 118\cr\cr
Lebart, L., Morineau, L. and Warwick, K.M. (1984) \emph{Multivariate descriptive analysis: correspondence and related techniques for large matrices}, John Wiley and Sons, New York.\cr\cr
Greenacre, M. (1984) \emph{Theory and applications of correspondence analysis}, Academic Press, London, 66.\cr\cr
Rouanet, H. and Le Roux, B. (1993) \emph{Analyse des données multidimensionnelles},  Dunod, Paris, 143--144.\cr\cr
Tenenhaus, M. (1994) \emph{Méthodes statistiques en gestion},  Dunod, Paris, p. 160, 161, 166, 204.\cr\cr
Lebart, L., Morineau, A. and Piron, M. (1995) \emph{Statistique exploratoire multidimensionnelle}, Dunod, Paris,  p. 56,95-96.\cr
}
\details{Contributions are printed in 1/10000 and the sign is the sign of the coordinate
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(housetasks)
coa1 <- dudi.coa(housetasks, scann = FALSE)
inertia.dudi(coa1, col = TRUE, row = FALSE)$col.rel
}
\keyword{multivariate}

\eof
\name{irishdata}
\alias{irishdata}
\docType{data}
\title{Geary's Irish Data}
\description{
This data set contains geographical informations about 25 counties of Ireland. 
}
\usage{data(irishdata)}
\format{
    \code{irishdata} is a list of 11 objects.
\describe{
    \item{area}{is a data frame with polygons for each of the 25 contiguous counties.}
    \item{county.names}{is a vector with the names of the 25 counties.}
    \item{xy}{is a data frame with the coordinates centers of the 25 counties.}
    \item{tab}{is a data frame with 25 rows (counties) and 12 variables.}
    \item{contour}{is a data frame with the global polygon of all the 25 counties.}
    \item{link}{is a matrix containing the common length between two counties from \code{area}.}
    \item{area.utm}{is a data frame with polygons for each of the 25 contiguous counties expressed in Universal Transverse Mercator (UTM) coordinates.}
    \item{xy.utm}{is a data frame with the UTM coordinates centers of the 25 counties.}
    \item{link.utm}{is a matrix containing the common length between two counties from \code{area.utm}.}
    \item{tab.utm}{is a data frame with the 25 counties (explicitly named) and 12 variables.}
    \item{contour.utm}{is a data frame with the global polygon of all the 25 counties expressed in UTM coordinates.}
}}
\source{
Geary, R.C. (1954) The contiguity ratio and statistical mapping. \emph{The incorporated Statistician}, \bold{5}, 3, 115--145.

Cliff, A.D. and Ord, J.K. (1973) \emph{Spatial autocorrelation}, Pion, London. 1--178.
}
\examples{
data(irishdata)
par(mfrow = c(2,2))
area.plot(irishdata$area, lab = irishdata$county.names, clab = 0.75)
area.plot(irishdata$area)
apply(irishdata$contour, 1, function(x) segments(x[1],x[2],x[3],x[4], 
    lwd = 3))
s.corcircle(dudi.pca(irishdata$tab, scan = FALSE)$co)
score <- dudi.pca(irishdata$tab, scan = FALSE, nf = 1)$li$Axis1
names(score) <- row.names(irishdata$tab)
area.plot(irishdata$area, score)
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{is.euclid}
\alias{is.euclid}
\alias{summary.dist}
\alias{mat2dist}
\alias{dist2mat}
\title{Is a Distance Matrix Euclidean ?}
\description{
Confirmation of the Euclidean nature of a distance matrix by the Gower's theorem.\cr
is.euclid is used in summary.dist.\cr
mat2dist and dist2mat are local copies of as.dist and as.matrix.dist of mva.
}
\usage{
is.euclid(distmat, plot = FALSE, print = FALSE, tol = 1e-07)
summary.dist(object, \dots)
}
\arguments{
  \item{distmat}{an object of class 'dist'}
  \item{plot}{a logical value indicating whether the eigenvalues bar plot of the matrix of the term \eqn{-\frac{1}{2} {d_{ij}^2}}{-1/2 dij²} centred by rows and columns should be diplayed}
  \item{print}{a logical value indicating whether the eigenvalues of the matrix of the term \eqn{-\frac{1}{2} {d_{ij}^2}}{-1/2 dij²} centred by rows and columns should be printed}
  \item{tol}{a tolerance threshold : an eigenvalue is considered positive if it is larger than \code{-tol*lambda1} where \code{lambda1} is the largest eigenvalue.}
  \item{object}{an object of class 'dist'}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns a logical value indicating if all the eigenvalues are positive or equal to zero
}
\references{Gower, J.C. and Legendre, P. (1986) Metric and Euclidean properties of dissimilarity coefficients. \emph{Journal of Classification}, \bold{3}, 5--48.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
w <- matrix(runif(10000), 100, 100)
w <- dist(w)
summary(w)
is.euclid (w) # TRUE
w <- quasieuclid(w) # no correction need in: quasieuclid(w)
w <- lingoes(w) # no correction need in: lingoes(w)
w <- cailliez(w) # no correction need in: cailliez(w)
rm(w)
}
\keyword{array}

\eof
\name{julliot}
\alias{julliot}
\docType{data}
\title{Seed dispersal}
\description{
This data set gives the spatial distribution of seeds (quadrats counts) of seven species in the understorey of tropical rainforest.
}
\usage{data(julliot)}
\format{
\code{julliot} is a list containing the 3 following objects : 
\describe{   
            \item{tab}{is a data frame with 160 rows (quadrats) and 7 variables (species).} 
            \item{xy}{is a data frame with the coordinates of the 160 quadrats (positioned by their centers).}
            \item{area}{is a data frame with 3 variables returning the boundary lines of each quadrat. The first variable is a factor. The levels of this one are the row.names of \code{tab}. The second and third variables return the coordinates (x,y) of the points of the boundary line.}    
}

Species names of \code{julliot$tab} are \emph{Pouteria torta}, \emph{Minquartia guianensis}, \emph{Quiina obovata}, \emph{Chrysophyllum lucentifolium}, \emph{Parahancornia fasciculata}, \emph{Virola michelii}, \emph{Pourouma spp}.
}
\references{
Julliot, C. (1992) Utilisation des ressources alimentaires par le singe hurleur roux, 
\emph{Alouatta seniculus} (Atelidae, Primates), en Guyane : 
impact de la dissémination des graines sur la régénération forestière. Thèse de troisième cycle, Université de Tours.

Julliot, C. (1997) Impact of seed dispersal by red howler monkeys \emph{Alouatta seniculus} 
on the seedling population in the understorey of tropical rain forest. \emph{Journal of Ecology}, \bold{85}, 431--440.
}
\examples{
data(julliot)
par(mfrow = c(3,3))
\dontrun{
for(k in 1:7)
    area.plot(julliot$area,val = log(julliot$tab[,k]+1),
     sub = names(julliot$tab)[k], csub = 2.5)
}

if (require(splancs, quiet = TRUE)){
    par(mfrow = c(3,3))
    for(k in 1:7)
      s.image(julliot$xy, log(julliot$tab[,k]+1), kgrid = 3, span = 0.25,
      sub = names(julliot$tab)[k], csub = 2.5)
}

\dontrun{
par(mfrow = c(3,3))
for(k in 1:7) {
    area.plot(julliot$area)
    s.value(julliot$xy, scalewt(log(julliot$tab[,k]+1)),
     sub = names(julliot$tab)[k],csub = 2.5, add.p = TRUE)
}}
par(mfrow = c(3,3))
for(k in 1:7)
    s.value(julliot$xy,log(julliot$tab[,k]+1),
     sub = names(julliot$tab)[k], csub = 2.5)

\dontrun{
if (require(spdep, quiet = TRUE)){
par(mfrow = c(1,1))
neig0 <- nb2neig(dnearneigh(as.matrix(julliot$xy), 1, 1.8))
s.label(julliot$xy, neig = neig0, clab = 0.75, incl = FALSE,
 addax = FALSE, grid = FALSE)

gearymoran(neig.util.LtoG(neig0), log(julliot$tab+1))
orthogram(log(julliot$tab[,3]+1), ortho = scores.neig(neig0),
 nrepet = 9999)}
}}
\keyword{datasets}

\eof
\name{jv73}
\alias{jv73}
\docType{data}
\title{K-tables Multi-Regions}
\description{
This data set gives physical and physico-chemical variables, fish species, spatial coordinates about 92 sites. 
}
\usage{data(jv73)}
\format{
    \code{jv73} is a list of 6 components.
    \describe{
    \item{morpho}{is a data frame with 92 sites and 6 physical variables.}
    \item{phychi}{is a data frame with 92 sites and 12 physico-chemical variables.}
    \item{poi}{is a data frame with 92 sites and 19 fish species.}
    \item{xy}{is a data frame with 92 sites and 2 spatial coordinates.}
    \item{contour}{is a data frame for mapping.}
    \item{fac.riv}{is a factor distributing the 92 sites on 12 rivers.}
    }
}
\source{
Verneaux, J. (1973) Cours d'eau de Franche-Comté (Massif du Jura).
Recherches écologiques sur le réseau hydrographique du Doubs.
Essai de biotypologie. Thèse d'état, Besançon.
}
\examples{
data(jv73)
s.label(jv73$xy, contour = jv73$contour, incl = FALSE, 
    clab = 0.75)
s.class(jv73$xy, jv73$fac.riv, add.p = TRUE, cell = 0,
    axese = FALSE, csta = 0, cpoi = 0, clab = 1.25)

w <- split(jv73$morpho, jv73$fac.riv)
w <- lapply(w, function(x) t(dudi.pca(x, scann = FALSE)))
w <- ktab.list.dudi(w)
kplot(sepan(w), perm = TRUE, clab.r = 0, clab.c = 2, show = FALSE)
}
\keyword{datasets}

\eof
\name{kcponds}
\alias{kcponds}
\docType{data}
\title{Ponds in a nature reserve}
\description{
This data set contains informations about 33 ponds in De Maten reserve (Genk, Belgium).
}
\usage{data(kcponds)}
\format{
\describe{
        \item{tab}{: a data frame with 15 environmental variables(columns) on 33 ponds(rows)}
        \item{area}{: an object of class \code{area}}
        \item{xy}{: a data frame with the coordinates of ponds}
        \item{neig}{: an object of class \code{neig}}  }}

\details{ 
Variables of \code{kcponds$tab} are the following ones : depth, area, O2 (oxygen concentration), 
cond (conductivity), pH, Fe (Fe concentration), secchi (Secchi disk depth), N (NNO concentration),
TP (total phosphorus concentration), chla (chlorophyll-a concentration), EM (emergent macrophyte cover),
FM (floating macrophyte cover), SM (submerged macrophyte cover), denMI (total density of macroinvertebrates),
divMI (diversity macroinvertebrates)
}
\source{
Cottenie, K. (2002) Local and regional processes in a zooplankton metacommunity. PhD, Katholieke Universiteit Leuven, Leuven, Belgium. \cr
\url{http://www.kuleuven.ac.be/bio/eco/phdkarlcottenie.pdf}
}
\examples{
data(kcponds)

par(mfrow=c(3,1))
area.plot(kcponds$area)
s.label(kcponds$xy,add.p = TRUE, cpoi = 2, clab = 0)
s.label(kcponds$xy,add.p = TRUE, cpoi = 3, clab = 0)
s.label(kcponds$xy,add.p = TRUE, cpoi = 0, clab = 0,
     neig = kcponds$neig, cneig = 1)
area.plot(kcponds$area)
s.label(kcponds$xy, add.p = TRUE, clab = 1.5)
w <- as.numeric(scalewt(kcponds$tab$N))
s.value(kcponds$xy, w, cleg = 2, sub = "Nitrogen concentration",
     csub = 4, possub = "topright", include = FALSE)
pca1 <- dudi.pca(kcponds$tab, scan = FALSE, nf = 4)
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
multi1 <- multispati(pca1, nb2listw(neig2nb(kcponds$neig)),
     scan = FALSE, nfposi = 2, nfnega = 1)
summary(multi1)}
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{kdist}
\alias{kdist}
\alias{c.kdist}
\alias{print.kdist}
\alias{[.kdist}
\alias{as.data.frame.kdist}
\title{the class of objects 'kdist' (K distance matrices)}
\description{
An object of class \code{kdist} is a list of distance matrices observed on the same individuals
}
\usage{
kdist(..., epsi = 1e-07, upper = FALSE)
}
\arguments{
  \item{\dots}{ a sequence of objects of the class \code{kdist}. }
  \item{epsi}{ a tolerance threshold to test if distances are Euclidean (Gower's theorem) using \eqn{\frac{\lambda_n}{\lambda_1}} is larger than -epsi. }
  \item{upper}{ a logical value indicating whether the upper of a distance matrix is used (TRUE) or not (FALSE).  }
}
\value{
  returns an object of class 'kdist' containing a list of semidefinite matrices.
}
\details{
The attributs of a 'kdist' object are:\cr
\code{names}: the names of the distances\cr
\code{size}: the number of points between distances are known\cr
\code{labels}: the labels of points\cr
\code{euclid}: a logical vector indicating whether each distance of the list is Euclidean or not.\cr
\code{call}: a call order\cr
\code{class}: object 'kdist'\cr
}
\references{ Gower, J. C. (1966) Some distance properties of latent root and vector methods used in multivariate analysis. \emph{Biometrika}, \bold{53}, 325--338. }
\author{ Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Anne B Dufour \email{dufour@biomserv.univ-lyon1.fr}}
\examples{
# starting from a list of matrices 
data(yanomama)
lapply(yanomama,class)  
kd1 = kdist(yanomama)
print(kd1)

# giving the correlations of Mantel's test
cor(as.data.frame(kd1))
pairs(as.data.frame(kd1))

# starting from a list of objects 'dist'
data(friday87)
fri.w <- ktab.data.frame(friday87$fau, friday87$fau.blo, 
    tabnames = friday87$tab.names)
fri.kd = lapply(1:10, function(x) dist.binary(fri.w[[x]],2))
names(fri.kd) = friday87$tab.names
unlist(lapply(fri.kd,class)) # a list of distances
fri.kd = kdist(fri.kd)
fri.kd
s.corcircle(dudi.pca(as.data.frame(fri.kd), scan = FALSE)$co)

# starting from several distances
data(ecomor)
d1 <- dist.binary(ecomor$habitat, 1)
d2 <- dist.prop(ecomor$forsub, 5)
d3 <- dist.prop(ecomor$diet, 5)
d4 <- dist.quant(ecomor$morpho, 3)
d5 <- taxo2phylog(ecomor$taxo)$Wdist
ecomor.kd <- kdist(d1, d2, d3, d4, d5)
names(ecomor.kd) = c("habitat", "forsub", "diet", "morpho", "taxo")
class(ecomor.kd)
s.corcircle(dudi.pca(as.data.frame(ecomor.kd), scan = FALSE)$co)

data(bsetal97)
X <- prep.fuzzy.var(bsetal97$biol, bsetal97$biol.blo)
w1 <- attr(X, "col.num")
w2 <- levels(w1)
w3 <- lapply(w2, function(x) dist.quant(X[,w1==x], method = 1))
names(w3) <- names(attr(X, "col.blocks"))
w3 <- kdist(list = w3)
s.corcircle(dudi.pca(as.data.frame(w3), scan = FALSE)$co)

data(rpjdl)
w1 = lapply(1:10, function(x) dist.binary(rpjdl$fau, method = x))
w2 = c("JACCARD", "SOCKAL_MICHENER", "SOCKAL_SNEATH_S4", "ROGERS_TANIMOTO")
w2 = c(w2, "CZEKANOWSKI", "S9_GOWER_LEGENDRE", "OCHIAI", "SOKAL_SNEATH_S13")
w2 <- c(w2, "Phi_PEARSON", "S2_GOWER_LEGENDRE")
names(w1) <- w2
w3 = kdist(list = w1)
w4 <- dudi.pca(as.data.frame(w3), scan = FALSE)$co
w4
}
\keyword{multivariate}

\eof
\name{kdist2ktab}
\alias{kdist2ktab}
\title{ Transformation of K distance matrices (object 'kdist') into K Euclidean representations (object 'ktab') }
\description{
  The function creates a \code{ktab} object with the Euclidean representations from a \code{kdist} object. Notice that the euclid attribute must be TRUE for all elements.
}
\usage{
kdist2ktab(kd, scale = TRUE, tol = 1e-07)
}
\arguments{
  \item{kd}{ an object of class \code{kdist} }
  \item{scale}{ a logical value indicating whether the inertia of Euclidean representations are equal to 1 (TRUE) or not (FALSE).  }
  \item{tol}{ a tolerance threshold, an eigenvalue is considered equal to zero if \code{eig$values} > (\code{eig$values[1} * tol) }
}
\value{
returns a list of class \code{ktab} containing for each distance of \code{kd} the data frame of its Euclidean representation
}
\author{ Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Anne B Dufour \email{dufour@biomserv.univ-lyon1.fr}}
\examples{
data(friday87)
fri.w <- ktab.data.frame(friday87$fau, friday87$fau.blo, 
    tabnames = friday87$tab.names)
fri.kd <- lapply(1:10, function(x) dist.binary(fri.w[[x]], 10))
names(fri.kd) <-  substr(friday87$tab.names, 1, 4)
fri.kd <- kdist(fri.kd)
fri.ktab = kdist2ktab(kd = fri.kd)
fri.sepan = sepan(fri.ktab)
plot(fri.sepan, csub = 3)

tapply(fri.sepan$Eig, fri.sepan$TC[,1], sum)
# the sum of the eigenvalues is constant and equal to 1, for each K tables

fri.statis <- statis(fri.ktab, scan = FALSE, nf = 2)
round(fri.statis$RV, dig = 2)

fri.mfa <- mfa(fri.ktab, scan = FALSE, nf = 2)
fri.mcoa <- mcoa(fri.ktab, scan = FALSE, nf = 2)

apply(fri.statis$RV, 1, mean) 
fri.statis$RV.tabw 
plot(apply(fri.statis$RV, 1, mean), fri.statis$RV.tabw)
plot(fri.statis$RV.tabw, fri.statis$RV.tabw)
}
\keyword{ multivariate }

\eof
\name{kdisteuclid}
\alias{kdisteuclid}
\title{ a way to obtain Euclidean distance matrices }
\description{
 a way to obtain Euclidean distance matrices
}
\usage{
kdisteuclid(obj, method = c("lingoes", "cailliez", "quasi"))
}
\arguments{
  \item{obj}{ an object of class \code{kdist} }
  \item{method}{ a method to convert a distance matrix in a Euclidean one }
}
\value{
returns an object of class \code{kdist} with all distances Euclidean. 
}
\references{ 
Gower, J.C. and Legendre, P. (1986) Metric and Euclidean properties of dissimilarity coefficients. \emph{Journal of Classification},  \bold{3}, 5--48.

Cailliez, F. (1983) The analytical solution of the additive constant problem. \emph{Psychometrika},  \bold{48}, 305--310.

Lingoes, J.C. (1971) Somme boundary conditions for a monotone analysis of symmetric matrices. \emph{Psychometrika}, \bold{36}, 195--203.

Legendre, P. and Anderson, M.J. (1999) Distance-based redundancy analysis: testing multispecies responses in multifactorial ecological experiments. \emph{Ecological Monographs}, \bold{69}, 1--24.

Legendre, P., and L. Legendre. (1998) Numerical ecology, 2nd English edition edition. Elsevier Science BV, Amsterdam. 
}
\author{ Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} }
\note{ according to the program DistPCoa of P. Legendre and M.J. Anderson\cr
\url{http://www.fas.umontreal.ca/BIOL/Casgrain/en/labo/distpcoa.html}
}
\examples{
w <- c(0.8,0.8,0.377350269,0.8,0.377350269,0.377350269) # see ref.
w <- kdist(w)
w1 <- c(kdisteuclid(kdist(w), "lingoes"), kdisteuclid(kdist(w), "cailliez"),
    kdisteuclid(kdist(w), "quasi"))
print(w, print = TRUE)
print(w1, print = TRUE)

data(eurodist)
par(mfrow = c(1, 3))
eu1 <- kdist(eurodist) # an object of class 'dist'
plot(data.frame(unclass(c(eu1, kdisteuclid(eu1, "quasi")))), asp = 1)
title(main = "Quasi") ; abline(0,1)
plot(data.frame(unclass(c(eu1, kdisteuclid(eu1, "lingoes")))), asp = 1)
title(main = "Lingoes") ; abline(0,1)
plot(data.frame(unclass(c(eu1, kdisteuclid(eu1, "cailliez")))), asp = 1)
title(main = "Cailliez") ; abline(0,1)
}
\keyword{ multivariate }
\keyword{ utilities }

\eof
\name{kplot}
\alias{kplot}
\title{Generic Function for Multiple Graphs in a K-tables Analysis}
\description{
	Methods for \code{foucart}, \code{mcoa}, \code{mfa}, \code{pta}, \code{sepan}, \code{sepan.coa} and \code{statis}
}
\usage{
kplot(object, ...)
}
\arguments{
  \item{object}{an object used to select a method}
  \item{\dots}{further arguments passed to or from other methods}
}
\examples{
methods(plot)
methods(scatter)
methods(kplot)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{kplot.foucart}
\alias{kplot.foucart}
\title{Multiple Graphs for the Foucart's Correspondence Analysis}
\description{
performs high level plots of a Foucart's Correspondence Analysis, 
using an object of class \code{foucart}.  
}
\usage{
kplot.foucart(object, xax = 1, yax = 2, mfrow = NULL, 
    which.tab = 1:length(object$blo), clab.r = 1, clab.c = 1.25, 
    csub = 2, possub = "bottomright", \dots)
}
\arguments{
  \item{object}{an object of class \code{foucart} }
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{mfrow}{a vector of the form 'c(nr,nc)', otherwise computed by as special own function \code{n2mfrow}}
  \item{which.tab}{vector of table numbers for analyzing}
  \item{clab.r}{a character size for the row labels}
  \item{clab.c}{a character size for the column labels}
  \item{csub}{a character size for the sub-titles used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(bf88)
fou1 <- foucart(bf88, scann = FALSE, nf = 3)
kplot(fou1, clab.r = 0, clab.c = 2, csub = 3)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{kplot.mcoa}
\alias{kplot.mcoa}
\title{Multiple Graphs for a Multiple Co-inertia Analysis}
\description{
performs high level plots of a Multiple Co-inertia Analysis, 
using an object of class \code{mcoa}. 
}
\usage{
kplot.mcoa(object, xax = 1, yax = 2, which.tab = 1:nrow(object$cov2), 
    mfrow = NULL, option = c("points", "axis", "columns"), 
    clab = 1, cpoint = 2, csub = 2, possub = "bottomright",\dots)
}
\arguments{
  \item{object}{an object of class \code{mcoa}}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{which.tab}{a numeric vector containing the numbers of the tables to analyse}
  \item{mfrow}{a vector of the form 'c(nr,nc)', otherwise computed by as special own function \code{n2mfrow}}
  \item{option}{a string of characters for the drawing option
      \item{"points"}{plot of the projected scattergram onto the co-inertia axes}
      \item{"axis"}{projections of inertia axes onto the co-inertia axes.}
      \item{"columns"}{projections of variables onto the synthetic variables planes.}
  }
  \item{clab}{a character size for the labels}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")}*cpoint. If zero, no points are drawn.}
  \item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(friday87)
w1 <- data.frame(scale(friday87$fau, scal = FALSE))
w2 <- ktab.data.frame(w1, friday87$fau.blo, 
    tabnames = friday87$tab.names)
mcoa1 <- mcoa(w2, "lambda1", scan = FALSE)
kplot(mcoa1, clab = 2, csub = 2, cpoi = 3, opt = "axis")

kplot(mcoa1, mfrow = c(3,4), clab = 2, csub = 3, cpoi = 3)

kplot(mcoa1, clab = 2, csub = 3, cpoi = 3, mfrow = c(3,4), 
    opt = "columns")
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{kplot.mfa}
\alias{kplot.mfa}
\title{Multiple Graphs for a Multiple Factorial Analysis}
\description{
performs high level plots of a Multiple Factorial Analysis, 
using an object of class \code{mfa}. 
}
\usage{
kplot.mfa(object, xax = 1, yax = 2, mfrow = NULL, 
    which.tab = 1:length(object$blo), row.names = FALSE, col.names = TRUE, 
    traject = FALSE, permute.row.col = FALSE, 
    clab = 1, csub = 2, possub = "bottomright", \dots)
}
\arguments{
  \item{object}{an object of class \code{mfa}}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{mfrow}{a vector of the form 'c(nr,nc'), otherwise computed by a special own function \code{n2mfrow}}
  \item{which.tab}{vector of the numbers of tables used for the analysis}
  \item{row.names}{a logical value indicating whether the row labels should be inserted}
  \item{col.names}{a logical value indicating whether the column labels should be inserted}
  \item{traject}{a logical value indicating whether the trajectories of the rows should be drawn in a natural order}
  \item{permute.row.col}{if TRUE, the rows are represented by vectors and columns by points, otherwise it is the opposite}
  \item{clab}{a character size for the labels}
  \item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(friday87)
w1 <- data.frame(scale(friday87$fau, scal = FALSE))
w2 <- ktab.data.frame(w1, friday87$fau.blo, 
    tabnames = friday87$tab.names)
mfa1 <- mfa(w2, scann = FALSE)
kplot(mfa1)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{kplot.pta}
\alias{kplot.pta}
\title{Multiple Graphs for a Partial Triadic Analysis}
\description{
performs high level plots of a Partial Triadic Analysis, 
using an object of class \code{pta}. 
}
\usage{
kplot.pta(object, xax = 1, yax = 2, which.tab = 1:nrow(object$RV), 
    mfrow = NULL, which.graph = 1:4, clab = 1, cpoint = 2, csub = 2, 
    possub = "bottomright", ask = par("ask"), ...)
}
\arguments{
  \item{object}{an object of class \code{pta}}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{which.tab}{a numeric vector containing the numbers of the tables to analyse}
  \item{mfrow}{parameter of the array of figures to be drawn, otherwise the graphs associated to a table are drawn on the same row}
 \item{which.graph}{an option for drawing, an integer between 1 and 4. For each table of which.tab, are drawn :
      \item{1}{the projections of the principal axes}
      \item{2}{the projections of the rows}
      \item{3}{the projections of the columns}
      \item{4}{the projections of the principal components onto the planes of the compromise}
  }
  \item{clab}{a character size for the labels}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")}*cpoint. If zero, no points are drawn.}
  \item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{ask}{a logical value indicating if the graphs requires several arrays of figures}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(meaudret)
wit1 <- within(dudi.pca(meaudret$fau, scan = FALSE, scal = FALSE), 
    meaudret$plan$dat, scan = FALSE)
kta1 <- ktab.within(wit1, colnames = rep(c("S1","S2","S3","S4","S5"), 4))
kta2 <- t(kta1) ; pta1 <- pta(kta2, scann = FALSE)
kplot(pta1, clab = 1.5, csub = 3)
kplot(pta1, clab = 1.5, csub = 3, which.graph = 3, mfrow = c(2,2))
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{kplot.sepan}
\alias{kplot.sepan}
\alias{kplot.sepan.coa}
\title{Multiple Graphs for Separated Analyses in a K-tables}
\description{
performs high level plots for Separed Analyses in a K-tables, 
using an object of class \code{sepan}. 
}
\usage{
kplot.sepan(object, xax = 1, yax = 2, which.tab = 1:length(object$blo), 
    mfrow = NULL, permute.row.col = FALSE, clab.row = 1, 
    clab.col = 1.25, traject.row = FALSE, csub = 2, 
    possub = "bottomright", show.eigen.value = TRUE,\dots)

kplot.sepan.coa (object, xax = 1, yax = 2, which.tab = 1:length(object$blo), 
    mfrow = NULL, permute.row.col = FALSE, clab.row = 1, 
    clab.col = 1.25, csub = 2, possub = "bottomright", 
    show.eigen.value = TRUE, poseig = c("bottom", "top"), \dots)
}
\arguments{
  \item{object}{an object of class \code{sepan}}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{which.tab}{a numeric vector containing the numbers of the tables to analyse}
  \item{mfrow}{parameter for the array of figures to be drawn, otherwise use n2mfrow}
  \item{permute.row.col}{if TRUE the rows are represented by arrows and the columns by points, if FALSE it is the opposite}
  \item{clab.row}{a character size for the row labels}
  \item{clab.col}{a character size for the column labels}
  \item{traject.row}{a logical value indicating whether the trajectories between rows should be drawn in a natural order}
  \item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{show.eigen.value}{a logical value indicating whether the eigenvalues bar plot should be drawn}
  \item{poseig}{if "top" the eigenvalues bar plot is upside, if "bottom", it is downside}
  \item{\dots}{further arguments passed to or from other methods}
}
\details{
\code{kplot.sepan} superimposes the points for the rows and the arrows for the columns using an adapted rescaling such as the scatter.dudi.\cr
\code{kplot.sepan.coa} superimposes the row coordinates and the column coordinates with the same scale.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(escopage)
w <- data.frame(scale(escopage$tab))
w <- ktab.data.frame(w, escopage$blo, tabnames = escopage$tab.names)
sep1 <- sepan(w)
kplot(sep1, show = FALSE)

data(friday87)
w <- data.frame(scale(friday87$fau, scal = FALSE))
w <- ktab.data.frame(w, friday87$fau.blo, tabnames = friday87$tab.names)
kplot(sepan(w), clab.r = 1.25, clab.c = 0, csub = 3)

data(microsatt)
w <- dudi.coa(data.frame(t(microsatt$tab)), scann = FALSE)
loci.fac <- factor(rep(microsatt$loci.names, microsatt$loci.eff))
wit <- within(w, loci.fac, scann = FALSE)
microsatt.ktab <- ktab.within(wit)
kplot.sepan.coa(sepan(microsatt.ktab), show = FALSE, clab.c = 0, 
    mfrow = c(3,3), clab.r = 1.5)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{kplot.statis}
\alias{kplot.statis}
\title{Multiple Graphs of a STATIS Analysis}
\description{
performs high level plots for a STATIS analysis, 
using an object of class \code{statis}. 
}
\usage{
kplot.statis(object, xax = 1, yax = 2, mfrow = NULL, 
    which.tab = 1:length(object$tab.names), clab = 1.5, cpoi = 2, 
    traject = FALSE, arrow = TRUE, class = NULL, 
    unique.scale = FALSE, csub = 2, possub = "bottomright",\dots)
}
\arguments{
  \item{object}{an object of class \code{statis}}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{mfrow}{parameter for the array of figures to be drawn}
  \item{which.tab}{a numeric vector containing the numbers of the tables to analyse}
  \item{clab}{a character size for the labels}
  \item{cpoi}{the size of points}
  \item{traject}{a logical value indicating whether the trajectories should be drawn in a natural order}
  \item{arrow}{a logical value indicating whether the column factorial diagrams should be plotted}
  \item{class}{if not NULL, a factor of length equal to the number of the total columns of the K-tables}
  \item{unique.scale}{if TRUE, all the arrays of figures have the same scale}
  \item{csub}{a character size for the labels of the arrays of figures used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(jv73)
dudi1 <- dudi.pca(jv73$poi, scann = FALSE, scal = FALSE)
wit1 <- within(dudi1, jv73$fac.riv, scann = FALSE)
kta3 <- ktab.within(wit1)
data(jv73)
statis3 <- statis(kta3, scann = FALSE)
kplot(statis3, traj = TRUE, arrow = FALSE, unique = TRUE, 
    clab = 0, csub = 3, cpoi = 3)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{krandtest}
\alias{krandtest}
\alias{plot.krandtest}
\alias{print.krandtest}
\title{Class of the Permutation Tests (in C).}
\description{
Plot and print many permutation tests. Objects of class \code{'krandtest'} are data frame with \emph{n+1} rows and \emph{p} columns. \cr
Each column corresponds to a permutation test : the first value is the observed-value and the \emph{n} others are the simulated ones.
}
\usage{
plot.krandtest(x, mfrow = NULL, nclass = NULL, main.title = names(x), ...)
print.krandtest(x, ...)
}
\arguments{
  \item{x}{: an object of class \code{'krandtest'}}
  \item{mfrow}{: a vector of the form 'c(nr,nc)', otherwise computed by as special own function \code{n2mfrow}}
  \item{nclass}{: a number of intervals for the histogram}
  \item{main.title}{: a string of character for the main title}
  \item{\dots}{: further arguments passed to or from other methods}
}
\value{
\code{plot.krandtest} draws the \emph{p} simulated values histograms and the position of the observed value.
}
\seealso{\code{\link{randtest}}}
\examples{
wkrandtest <- data.frame(eg1=c(0, rnorm(200)))
for (x0 in c(1.2,2.4,3.4,5.4,20.4)) {
    wkrandtest <- cbind.data.frame(wkrandtest, c(x0, rnorm(200)))
}
names(wkrandtest) <- paste ("Test",1:6,sep="_")
class(wkrandtest) <- "krandtest"
wkrandtest
plot(wkrandtest)
}
\keyword{methods}

\eof
\name{ktab}
\alias{ktab}
\alias{is.ktab}
\alias{c.ktab}
\alias{[.ktab}
\alias{print.ktab}
\alias{t.ktab}
\alias{row.names.ktab}
\alias{row.names<-.ktab}
\alias{col.names}
\alias{col.names.ktab}
\alias{col.names<-}
\alias{col.names<-.ktab}
\alias{tab.names}
\alias{tab.names.ktab}
\alias{tab.names<-}
\alias{tab.names<-.ktab}
\alias{ktab.util.names}
\alias{ktab.util.addfactor<-}
\title{the class of objects 'ktab' (K-tables)}
\description{
an object of class \code{ktab} is a list of data frames with the same row.names in common.\cr
a list of class 'ktab' contains moreover :
 \item{blo}{: the vector of the numbers of columns for each table}
 \item{lw}{: the vector of the row weightings in common for all tables}
 \item{cw}{: the vector of the column weightings}
 \item{TL}{: a data frame of two components to manage the parameter positions associated with the rows of tables}
 \item{TC}{: a data frame of two components to manage the parameter positions associated with the columns of tables}
 \item{T4}{: a data frame of two components to manage the parameter positions of 4 components associated to an array}
}
\usage{
c.ktab (...)
x[selection]
is.ktab(x)
t.ktab(x)
row.names.ktab(x)
col.names.ktab(x)
tab.names(x)
col.names(x)
ktab.util.names(x)
}
\arguments{
  \item{x}{an object of the class \code{ktab}}
  \item{\dots}{a sequence of objects of the class \code{ktab}}
  \item{selection}{an integer vector}
}
\details{
A 'ktab' object can be created with :\cr
    a list of data frame : \code{\link{ktab.list.df}}\cr
    a list of \code{dudi} objects : \code{\link{ktab.list.dudi}}\cr
    a data.frame : \code{\link{ktab.data.frame}}\cr
    an object \code{within} : \code{\link{ktab.within}}\cr
    a couple of \code{ktab}s : \code{\link{ktab.match2ktabs}}\cr
}
\value{
\code{c.ktab} returns an object \code{ktab}. It concatenates K-tables with the same rows in common. \cr
\code{t.ktab} returns an object \code{ktab}. It permutes each data frame into a K-tables. All tables have the same column names and the same column weightings (a data cube). \cr
\code{"["} returns an object \code{ktab}. It allows to select some arrays in a K-tables. \cr
\code{is.ktab} returns TRUE if x is a K-tables. \cr
\code{row.names} returns the vector of the row names common with all the tables of a K-tables and allowes to modifie them.\cr
\code{col.names} returns the vector of the column names of a K-tables and allowes to modifie them.\cr
\code{tab.names} returns the vector of the array names of a K-tables and allowes to modifie them.\cr
\code{ktab.util.names} is a useful function.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(friday87)
wfri <- data.frame(scale(friday87$fau, scal = FALSE))
wfri <- ktab.data.frame(wfri, friday87$fau.blo)
wfri[2:4]
c(wfri[2:4], wfri[5])

data(meaudret)
wit1 <- within.pca(meaudret$mil, meaudret$plan$dat, scan = FALSE, 
    scal = "partial")
kta1 <- ktab.within(wit1, colnames = rep(c("S1","S2","S3","S4","S5"), 4))
kta2 <- t(kta1)
kplot(sepan(kta2), clab.r = 1.5, clab.c = 0.75)
}
\keyword{multivariate}

\eof
\name{ktab.data.frame}
\alias{ktab.data.frame}
\title{Creation of K-tables from a data frame}
\description{
creates K tables from a data frame. 
}
\usage{
ktab.data.frame(df, blocks, rownames = NULL, colnames = NULL, 
    tabnames = NULL, w.row = rep(1, nrow(df)) / nrow(df), 
    w.col = rep(1, ncol(df)))
}
\arguments{
  \item{df}{a data frame}
  \item{blocks}{an integer vector for which the sum must be the number of variables of df. Its length is the number of arrays of the K-tables}
  \item{rownames}{the row names of the K-tables (otherwise the row names of df)}
  \item{colnames}{the column names of the K-tables (otherwise the column names of df)}
  \item{tabnames}{the names of the arrays of the K-tables (otherwise "Ana1", "Ana2", \dots)}
  \item{w.row}{a vector of the row weightings}
  \item{w.col}{a vector of the column weightings}
}
\value{
returns a list of class \code{ktab}. See \code{\link{ktab}}.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(escopage)
wescopage <- data.frame(scalewt(escopage$tab))
wescopage <- ktab.data.frame(wescopage, escopage$blo,
        tabnames = escopage$tab.names)
plot(sepan(wescopage))
data(friday87)
w <- data.frame(scale(friday87$fau, scal = FALSE))
w <- ktab.data.frame(w, friday87$fau.blo, tabnames = friday87$tab.names)
kplot(sepan(w))
}
\keyword{multivariate}

\eof
\name{ktab.list.df}
\alias{ktab.list.df}
\title{Creating a K-tables from a list of data frames.
}
\description{
creates a list of class \code{ktab} from a list of data frames 
}
\usage{
ktab.list.df(obj, rownames = NULL, colnames = NULL, tabnames = NULL, 
    w.row = rep(1, nrow(obj[[1]])), w.col = lapply(obj, function(x) 
    rep(1 / ncol(x), ncol(x))))
}
\arguments{
  \item{obj}{a list of data frame}
  \item{rownames}{the names of the K-tables rows (otherwise, the row names of the arrays)}
  \item{colnames}{the names of the K-tables columns (otherwise, the column names of the arrays)}
  \item{tabnames}{the names of the arrays of the K-tables (otherwise, the names of the obj if they exist, or else "Ana1", "Ana2", \dots)}
  \item{w.row}{a vector of the row weightings in common with all the arrays}
  \item{w.col}{a list of the vector of the column weightings for each array}
}
\details{
Each element of the initial list have to possess the same names and row numbers
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\value{
returns a list of class \code{ktab}. See \code{\link{ktab}}
}
\examples{
data(jv73)
l0 <- split(jv73$morpho, jv73$fac.riv)
l0 <- lapply(l0, function(x) data.frame(t(scalewt(x))))
kta <- ktab.list.df(l0)
kplot(sepan(kta[c(2,5,7,10)]), perm = TRUE, clab.r = 1, clab.c = 1.5)
}
\keyword{multivariate}

\eof
\name{ktab.list.dudi}
\alias{ktab.list.dudi}
\title{Creation of a K-tables from a list of duality diagrams}
\description{
creates a list of class \code{ktab} from a list of duality diagrams. 
}
\usage{
ktab.list.dudi(obj, rownames = NULL, colnames = NULL, tabnames = NULL)
}
\arguments{
  \item{obj}{a list of objects of class 'dudi'. Each element of the list must have the same row names for \code{$tab} and even for \code{$lw}}
  \item{rownames}{the row names of the K-tables (otherwise the row names of the \code{$tab})}
  \item{colnames}{the column names of the K-tables (otherwise the column names of the \code{$tab})}
  \item{tabnames}{the names of the arrays of the K-tables (otherwise the names of the \code{obj}  if they exist, or else "Ana1", "Ana2", \dots)}
}
\value{
returns a list of class \code{ktab}. See \code{\link{ktab}}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(euro123)
pca1 <- dudi.pca(euro123$in78, scale = FALSE, scann = FALSE)
pca2 <- dudi.pca(euro123$in86, scale = FALSE, scann = FALSE)
pca3 <- dudi.pca(euro123$in97, scale = FALSE, scann = FALSE)
ktabeuro <- ktab.list.dudi(list(pca1, pca2, pca3), 
    tabnames = c("1978","1986","1997"))
kplot(sepan(ktabeuro), mfr = c(2,2), clab.c = 1.5)

data(meaudret)
w1 <- split(meaudret$mil,meaudret$plan$dat)
ll <- lapply(w1, dudi.pca, scann = FALSE)
kta <- ktab.list.dudi(ll, rownames <- paste("Station", 1:5, sep=""))
kplot(sepan(kta), clab.r = 1.5, clab.c = 0.75)

data(jv73)
w <- split(jv73$poi, jv73$fac.riv)
wjv73poi <- lapply(w, dudi.pca, scal = FALSE, scan = FALSE)
wjv73poi <- lapply(wjv73poi, t)
wjv73poi <- ktab.list.dudi(wjv73poi)
kplot(sepan(wjv73poi), permut = TRUE, traj = TRUE)
}
\keyword{multivariate}

\eof
\name{ktab.match2ktabs}
\alias{ktab.match2ktabs}
\title{STATIS and Co-Inertia : Analysis of a series of paired ecological tables}
\description{
Prepares the analysis of a series of paired ecological tables. Partial Triadic
Analysis (see \code{\link{pta}}) can be used thereafter to perform the analysis of this k-table.
}
\usage{
ktab.match2ktabs(KTX, KTY)
}
\arguments{
  \item{KTX}{an objet of class \code{ktab}}
  \item{KTY}{an objet of class \code{ktab}}
}
\value{
a list of class \code{ktab}, subclass \code{kcoinertia}. See \code{\link{ktab}}
}
\references{
Thioulouse J., Simier M. and Chessel D. (2004). Simultaneous analysis of a sequence of paired ecological tables.  \emph{Ecology} \bold{85}, 272-283.. 

Simier, M., Blanc L., Pellegrin F., and Nandris D. (1999). Approche simultanée de K couples de tableaux : 
Application a l'étude des relations pathologie végétale - environnement. \emph{Revue de Statistique Appliquée}, \bold{47}, 31-46.
}
\author{Jean Thioulouse \email{ade4@biomserv.univ-lyon1.fr}}
\section{WARNING }{
IMPORTANT : \code{KTX} and \code{KTY} must have the same k-tables structure, the same number
of columns, and the same column weights.
}
\examples{
data(meau)
wit1 <- within.pca(meau$mil, meau$plan$dat, scan = FALSE, scal = "total")
pcafau <- dudi.pca(meau$fau, scale = FALSE, scan = FALSE, nf = 2)
wit2 <- within(pcafau, meau$plan$dat, scan = FALSE, nf = 2)
kta1 <- ktab.within(wit1, colnames = rep(c("S1","S2","S3","S4","S5","S6"), 4))
kta2 <- ktab.within(wit2, colnames = rep(c("S1","S2","S3","S4","S5","S6"), 4))
kcoi <- ktab.match2ktabs(kta1, kta2)
ptacoi <- pta(kcoi, scan = FALSE, nf = 2)
plot(ptacoi)
kplot(ptacoi)
}
\keyword{multivariate}

\eof
\name{ktab.within}
\alias{ktab.within}
\title{Process to go from a Within Analysis to a K-tables}
\description{
performs the process to go from a Within Analysis to a K-tables. 
}
\usage{
ktab.within(dudiwit, rownames = NULL, colnames = NULL, tabnames = NULL)
}
\arguments{
  \item{dudiwit}{an objet of class \code{within}}
  \item{rownames}{the row names of the K-tables (otherwise the row names of \code{dudiwit$tab})}
  \item{colnames}{the column names of the K-tables (otherwise the column names of \code{dudiwit$tab})}
  \item{tabnames}{the names of the arrays of the K-tables (otherwise the levels of the factor which defines the within-classes)}
}
\value{
a list of class \code{ktab}. See \code{\link{ktab}}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(bacteria)
w1 <- data.frame(t(bacteria$espcodon))
dudi1 <- dudi.coa(w1, scann = FALSE, nf = 4)
wit1 <- within(dudi1, bacteria$code, scannf = FALSE)
kta1 <- ktab.within(wit1)
plot(statis(kta1, scann = FALSE))

kta2 <- kta1[kta1$blo>3]
kplot(mfa(kta2, scann = FALSE))
}
\keyword{multivariate}

\eof
\name{lascaux}
\alias{lascaux}
\docType{data}
\title{Genetic/Environment and types of variables}
\description{
This data set gives meristic, genetic and morphological data frame 
for 306 trouts.  
}
\usage{data(lascaux)}
\format{
    \code{lascaux} is a list of 9 components.
    \describe{
        \item{riv}{is a factor returning the river where 306 trouts are captured}
        \item{code}{vector of characters : code of the 306 trouts}
        \item{sex}{factor sex of the 306 trouts}
        \item{meris}{data frame 306 trouts - 5 meristic variables}
        \item{tap}{data frame of the total number of red and black points}
        \item{gen}{factor of the genetic code of the 306 trouts}
        \item{morpho}{data frame 306 trouts 37 morphological variables}
        \item{colo}{data frame 306 trouts 15 variables of coloring}
        \item{ornem}{data frame 306 trouts 15 factors (ornementation)}
    }
}
\source{
Lascaux, J.M. (1996)
\emph{Analyse de la variabilité morphologique de la truite commune (Salmo trutta L.) dans les cours d'eau du bassin pyrénéen méditerranéen}.
Thèse de doctorat en sciences agronomiques, INP Toulouse.
}
\examples{
data(lascaux)
par(mfrow = c(2,2))
barplot(dudi.pca(lascaux$meris, scan = FALSE)$eig)
title(main = "Meristic")
barplot(dudi.pca(lascaux$colo, scan = FALSE)$eig)
title(main = "Coloration")
barplot(dudi.pca(na.omit(lascaux$morpho), scan = FALSE)$eig)
title(main = "Morphometric")
barplot(dudi.acm(na.omit(lascaux$orne), scan = FALSE)$eig)
title(main = "Ornemental")
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{lingoes}
\alias{lingoes}
\title{Transformation of a Distance Matrix for becoming Euclidean}
\description{
transforms a distance matrix in a Euclidean one. 
}
\usage{
lingoes(distmat, print = FALSE)
}
\arguments{
  \item{distmat}{an object of class \code{dist}}
  \item{print}{if TRUE, prints the eigenvalues of the matrix}
}
\value{
returns an object of class \code{dist} with a Euclidean distance
}
\references{Lingoes, J.C. (1971) Some boundary conditions for a monotone analysis of symmetric matrices. 
\emph{Psychometrika}, \bold{36}, 195--203. 
}
\details{
 The function uses the smaller positive constant k which transforms the matrix of \eqn{\sqrt{d_{ij}^2 + 2 \ast k}}{sqrt(dij² + 2*k)} in an Euclidean one
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(capitales)
d0 <- as.dist(capitales$df)
is.euclid(d0) # FALSE
d1 <- lingoes(d0, TRUE)
# Lingoes constant = 2120982
is.euclid(d1) # TRUE
plot(d0, d1)
x0 <- sort(unclass(d0))
lines(x0, sqrt(x0^2 + 2 * 2120982), lwd = 3)
 
is.euclid(sqrt(d0^2 + 2 * 2120981), tol = 1e-10) # FALSE
is.euclid(sqrt(d0^2 + 2 * 2120982), tol = 1e-10) # FALSE
is.euclid(sqrt(d0^2 + 2 * 2120983), tol = 1e-10) 
    # TRUE the smaller constant
}
\keyword{array}
\keyword{multivariate}

\eof
\name{lizards}
\alias{lizards}
\docType{data}
\title{Phylogeny and quantitative traits of lizards}
\description{
This data set describes the phylogeny of 18 lizards as reported by Bauwens and Díaz-Uriarte (1997). It also gives life-history traits corresponding to these 18 species.
}
\usage{data(lizards)}
\format{
\code{lizards} is a list containing the 3 following objects : 
\describe{    
   \item{traits}{is a data frame with 18 species and 8 traits.}  
   \item{hprA}{is a character string giving the phylogenetic tree (hypothesized phylogenetic relationships based on immunological distances) in Newick format.} 
   \item{hprB}{is a character string giving the phylogenetic tree (hypothesized phylogenetic relationships based on morphological characteristics) in Newick format.}
}}
\details{
Variables of \code{lizards$traits} are the following ones : 
mean.L (mean length (mm)), matur.L (length at maturity (mm)), 
max.L (maximum length (mm)), hatch.L (hatchling length (mm)),
hatch.m (hatchling mass (g), clutch.S} (Clutch size),
age.mat (age at maturity (number of months of activity)),
clutch.F (clutch frequency).
}
\references{
Bauwens, D., and Díaz-Uriarte, R. (1997) Covariation of life-history traits in lacertid lizards: a comparative study. \emph{American Naturalist}, \bold{149}, 91--111.
}
\examples{
data(lizards)
w <- data.frame(scalewt(log(lizards$traits)))
par(mfrow = c(1,2))
wphy <- newick2phylog(lizards$hprA)
table.phylog(w, wphy, csi = 3)
wphy <- newick2phylog(lizards$hprB)
table.phylog(w, wphy, csi = 3)
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{macaca}
\alias{macaca}
\docType{data}
\title{Landmarks}
\description{
This data set gives the landmarks of a macaca at the ages of 0.9 and 5.77 years. 
}
\usage{data(macaca)}
\format{
    \code{macaca} is a list of 2 components.
    \describe{
    \item{xy1}{is a data frame with 72 points and 2 coordinates.}
    \item{xy2}{is a data frame with 72 points and 2 coordinates.}
    }
}
\source{
Olshan, A.F., Siegel, A.F. and Swindler, D.R. (1982)
Robust and least-squares orthogonal mapping: Methods for the study of cephalofacial form and growth.
\emph{American Journal of Physical Anthropology}, \bold{59}, 131--137.
}
\examples{
data(macaca)
par(mfrow = c(2,2))
s.match(macaca$xy1, macaca$xy2, clab = 0)
pro1 <- procuste(macaca$xy1, macaca$xy2, scal = FALSE)
s.match(pro1$tab1, pro1$rot2, clab = 0.7)
s.match(pro1$tab2, pro1$rot1, clab = 0.7)
pro2 <- procuste(macaca$xy1, macaca$xy2)
s.match(pro2$tab2, pro2$rot1, clab = 0.7)
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{macon}
\alias{macon}
\docType{data}
\title{Wine Tasting}
\usage{data(macon)}
\description{
The \code{macon} data frame has 8 rows-wines and 25 columns-tasters.
Each column is a classification of 8 wines (Beaujolais, France).
}
\source{
Foire Nationale des Vins de France, Mâcon, 1985
}
\examples{
data(macon)
s.corcircle(dudi.pca(macon, scan = FALSE)$co)
}
\keyword{datasets}

\eof
\name{mafragh}
\alias{mafragh}
\docType{data}
\title{Phyto-Ecological Survey}
\description{
This data set gives environmental and spatial informations about species and sites. 
}
\usage{data(mafragh)}
\format{
    \code{mafragh} is a list of 6 components.
\describe{
        \item{xy}{are the coordinates of 97 sites.}
        \item{flo}{is a data frame with 97 sites and 56 species.}
        \item{espnames}{is a vector of the names of species.}
        \item{neig}{is the neighbourhood graph of the 97 sites (an object of class 'neig').}
        \item{mil}{is a data frame with 97 sites and 11 environmental variables.}
        \item{partition}{is a factor classifying the 97 sites in 5 classes.}
        \item{area}{is a data frame of class \code{area}}
}}
\source{
Belair, G.d. and Bencheikh-Lehocine, M. (1987) Composition et déterminisme de la végétation d'une plaine côtière marécageuse : La Mafragh (Annaba, Algérie). \emph{Bulletin d'Ecologie}, \bold{18}, 393--407.
}
\examples{
data(mafragh)
par(mfrow = c(3,2))
s.label(mafragh$xy, inc = FALSE, neig = mafragh$neig, 
    sub = "Samples & Neighbourhood graph")
coa1 <- dudi.coa(mafragh$flo, scan = FALSE)
s.value(mafragh$xy, coa1$li[,1], sub = "Axis 1 - COA")
pca1 <- dudi.pca(mafragh$xy, scan = FALSE)
s.value(mafragh$xy, pca1$li[,1], sub = "Axis 1 - PCA")
s.class(pca1$li, mafragh$partition, sub = "Plane 1-2 - PCA")
s.class(coa1$li, mafragh$partition, sub = "Plane 1-2 - COA")
s.chull(mafragh$xy, mafragh$partition, optchull = 1)
par(mfrow=c(1,1))

\dontrun{
link1 <- area2link(mafragh$area)
neig1 <- neig(mat01 = 1*(link1>0))
nb1 <- neig2nb(neig1)
par(mfrow = c(2,1))
area.plot(mafragh$area,center = mafragh$xy,clab=0.75)
area.plot(mafragh$area,center = mafragh$xy,graph=neig1)
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
    lw1 <- apply(link1,1,function(x) x[x>0])
    listw1 <- nb2listw(nb1,lw1)
    coa1 <- dudi.coa(mafragh$flo, scan = FALSE, nf = 4)
    ms1 <- multispati(coa1, listw1, scan = FALSE, nfp = 2, nfn = 0)
    summary(ms1)
    par(mfrow = c(2,2))
    barplot(coa1$eig)
    barplot(ms1$eig)
    s.corcircle(ms1$as)
    plot(coa1$li[,1], ms1$li[,1])
}
par(mfrow = c(1,1))
}}
\keyword{datasets}

\eof
\name{mantel.randtest}
\alias{mantel.randtest}
\title{Mantel test (correlation between two distance matrices (in C).)
}
\description{
Performs a Mantel test between two distance matrices.
}
\usage{
mantel.randtest(m1, m2, nrepet = 999)
}
\arguments{
  \item{m1}{an object of class \code{dist}}
  \item{m2}{an object of class \code{dist}}
  \item{nrepet}{the number of permutations}
}
\value{
an object of class \code{randtest} (randomization tests)
}
\references{Mantel, N. (1967) The detection of disease clustering and a generalized regression approach. \emph{Cancer Research}, \bold{27}, 209--220.
}
\examples{
data(yanomama)
gen <- quasieuclid(as.dist(yanomama$gen))
geo <- quasieuclid(as.dist(yanomama$geo))
plot(r1 <- mantel.randtest(geo,gen), main = "Mantel's test")
r1
}
\keyword{array}
\keyword{nonparametric}

\eof
\name{mantel.rtest}
\alias{mantel.rtest}
\title{Mantel test (correlation between two distance matrices (in R).)
}
\description{
Performs a Mantel test between two distance matrices.
}
\usage{
mantel.rtest(m1, m2, nrepet = 99)
}
\arguments{
  \item{m1}{an object of class \code{dist}}
  \item{m2}{an object of class \code{dist}}
  \item{nrepet}{the number of permutations}
}
\value{
an object of class \code{rtest} (randomization tests)
}
\references{Mantel, N. (1967) The detection of disease clustering and a generalized regression approach. \emph{Cancer Research}, \bold{27}, 209--220.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
library(mva)
    data(yanomama)
    gen <- quasieuclid(as.dist(yanomama$gen))
    geo <- quasieuclid(as.dist(yanomama$geo))
    plot(r1 <- mantel.rtest(geo,gen), main = "Mantel's test")
    r1
}
\keyword{array}
\keyword{nonparametric}

\eof
\name{maples}
\alias{maples}
\docType{data}
\title{Phylogeny and quantitative traits of flowers}
\description{
This data set describes the phylogeny of 17 flowers as reported by Ackerly and Donoghue (1998). It also gives 31 traits corresponding to these 17 species.
}
\usage{data(maples)}
\format{
\code{tithonia} is a list containing the 2 following objects :  
            \item{tre}{is a character string giving the phylogenetic tree in Newick format.} 
            \item{tab}{is a data frame with 17 species and 31 traits}    
}
\source{
Data were obtained from the URL \url{http://www.stanford.edu/~dackerly/acerdata.html}.
}
\references{
Ackerly, D. D. and Donoghue, M.J. (1998) Leaf size, sappling allometry, and Corner's rules: phylogeny and correlated evolution in Maples (Acer). 
\emph{American Naturalist}, \bold{152}, 767--791.
}
\examples{
data(maples)
phy <- newick2phylog(maples$tre)
dom <- maples$tab$Dom
bif <- maples$tab$Bif
orthogram(dom, phylog = phy)
orthogram(bif, phylog = phy)
par(mfrow = c(1,2))
dotchart.phylog(phy, dom)
dotchart.phylog(phy, bif, clabel.nodes = 0.7)
par(mfrow = c(1,1))
plot(bif,dom,pch = 20)
abline(lm(dom~bif))
summary(lm(dom~bif))
if (require(ape, quiet = TRUE)){
cor.test(bif,dom)
phylo <- read.tree(text = maples$tre)
pic.bif <- pic(bif, phylo)
pic.dom <- pic(dom, phylo)
cor.test(pic.bif, pic.dom)}
}
\keyword{datasets}

\eof
\name{mariages}
\alias{mariages}
\docType{data}
\title{Correspondence Analysis Table}
\description{
This array contains the socio-professionnal repartitions of 5850 couples.
}
\usage{data(mariages)}
\format{
The \code{mariages} data frame has 9 rows and 9 columns.
The rows represent the wife's socio-professionnal category and the columns the husband's socio-professionnal category (1982).\cr

Codes for rows and columns are identical : agri (Farmers), ouva (Farm workers),
pat (Company directors (commerce and industry)), sup (Liberal profession, executives and higher intellectual professions),
moy (Intermediate professions), emp (Other white-collar workers), ouv (Manual workers), serv (Domestic staff),
aut (other workers).
}
\source{
Vallet, L.A. (1986)
Activité professionnelle de la femme mariée et détermination de la position sociale de la famille.
Un test empirique : la France entre 1962 et 1982.
\emph{Revue Française de Sociologie}, \bold{27}, 656--696.
}
\examples{
data(mariages)
par(mfrow = c(2,2))
w <- dudi.coa(mariages, scan = FALSE, nf = 3)
scatter(w, met = 1, posi = "bottom")
scatter(w, met = 2, posi = "bottom")
scatter(w, met = 3, posi = "bottom")
score(w, 3)
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{mcoa}
\alias{mcoa}
\alias{print.mcoa}
\alias{summary.mcoa}
\alias{plot.mcoa}
\title{Multiple CO-inertia Analysis}
\description{
performs a multiple CO-inertia analysis, 
using an object of class \code{ktab}. 
}
\usage{
mcoa(X, option = c("inertia", "lambda1", "uniform", "internal"), 
    scannf = TRUE, nf = 3, tol = 1e-07)
print.mcoa (x, \dots)
summary.mcoa (object, \dots)
plot.mcoa (x, xax = 1, yax = 2, eig.bottom = TRUE, \dots)
}
\arguments{
  \item{X}{an object of class \code{ktab}}
  \item{option}{a string of characters for the weightings of the arrays options :
     \item{"inertia"}{weighting of group k by the inverse of the total inertia of the array k}
     \item{"lambda1"}{weighting of group k by the inverse of the first eigenvalue of the k analysis}
     \item{"uniform"}{uniform weighting of groups}
     \item{"internal"}{weighting included in \code{X$tabw}}
  }
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \item{tol}{a tolerance threshold, an eigenvalue is considered positive if it is larger than \code{-tol*lambda1} where \code{lambda1} is the largest eigenvalue.}
  \item{x, object}{an object of class 'mcoa'}
  \item{\dots}{further arguments passed to or from other methods}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{eig.bottom}{a logical value indicating whether the eigenvalues bar plot should be added}
}
\value{
mcoa returns a list of  class 'mcoa' containing :
  \item{pseudoeig}{a numeric vector with the all pseudo eigenvalues}
  \item{call}{the call-up order}
  \item{nf}{a numeric value indicating the number of kept axes}
  \item{SynVar}{a data frame with the synthetic scores}
  \item{axis}{a data frame with the co-inertia axes}
  \item{Tli}{a data frame with the co-inertia coordinates}
  \item{Tl1}{a data frame with the co-inertia normed scores}
  \item{Tax}{a data frame with the inertia axes onto co-inertia axis}
  \item{Tco}{a data frame with the column coordinates onto synthetic scores}
  \item{TL}{a data frame with the factors for Tli Tl1}
  \item{TC}{a data frame with the factors for Tco}
  \item{T4}{a data frame with the factors for Tax}
  \item{lambda}{a data frame with the all eigenvalues (computed on the separate analyses)}
  \item{cov2}{a numeric vector with the all pseudo eigenvalues (synthetic analysis)}
}
\references{
Chessel, D. and Hanafi, M. (1996) Analyses de la co-inertie de K nuages de points, \emph{Revue de Statistique Appliquée}, \bold{44}, 35--60.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(friday87)
w1 <- data.frame(scale(friday87$fau, scal = FALSE))
w2 <- ktab.data.frame(w1, friday87$fau.blo, tabnames = friday87$tab.names)
mcoa1 <- mcoa(w2, "lambda1", scan = FALSE)
mcoa1
summary(mcoa1)
plot(mcoa1)
}
\keyword{multivariate}

\eof
\name{meau}
\alias{meau}
\docType{data}
\title{Ecological Data : sites-variables, sites-species, where and when}
\description{
This data set contains informations about sites, environmental variables
and species (Trichopters). 
}
\usage{data(meau)}
\format{
\code{meau} is a list of 3 components.
\describe{
   \item{mil}{is a data frame with 24 sites and 10 variables.}
   \item{fau}{is a data frame with 24 sites and 13 species (Trichopters).}
   \item{plan}{is a data frame with 24 sites and 2 factors.
            \enumerate{
                \item{dat}{is a factor with 4 levels.}
                \item{sta}{is a factor with 6 levels.}
            }
        }
    }
}
\source{
Pegaz-Maucet, D. (1980)
\emph{Impact d'une perturbation d'origine organique sur la dérive des macro-invertébérés benthiques d'un cours d'eau.
Comparaison avec le benthos}.
Thèse de troisième cycle, Université Lyon 1, 130 p.
}
\examples{
data(meau)
par(mfrow = c(2,2))
pca1 <- dudi.pca(meau$mil, scan = FALSE, nf = 4)
s.class(pca1$li, meau$plan$dat, 
    sub = "Principal Component Analysis")
pca2 <- between(pca1, meau$plan$dat, scan = FALSE, nf = 2)
s.class(pca2$ls, meau$plan$dat, sub = "Between dates Principal Component Analysis")
s.corcircle(pca1$co)
s.corcircle(pca2$as)
}
\keyword{datasets}

\eof
\name{meaudret}
\alias{meaudret}
\docType{data}
\title{Ecological Data : sites-variables, sites-species, where and when}
\description{
This data set contains informations about sites, environmental variables
and species (Trichopters). 
}
\usage{data(meaudret)}
\format{
    \code{meaudret} is a list of 3 components.
\describe{
        \item{mil}{is a data frame with 24 sites and 9 variables.}
        \item{fau}{is a data frame with 24 sites and 13 species (Trichopters).}
        \item{plan}{is a data frame with 24 sites and 2 factors.
            \enumerate{
                \item{dat}{is a factor with 4 levels.}
                \item{sta}{is a factor with 5 levels.}
            }
        }
    }
}
\source{
Pegaz-Maucet, D. (1980) 
\emph{Impact d'une perturbation d'origine organique sur la dérive des macro-invertébérés benthiques d'un cours d'eau.
Comparaison avec le benthos.}
Thèse de troisième cycle, Université Lyon 1, 130 p.
}
\examples{
data(meaudret)
par(mfrow = c(2,2))
pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 4)
s.class(pca1$li, meaudret$plan$dat, 
    sub = "Principal Component Analysis")
pca2 <- between(pca1, meaudret$plan$dat, scan = FALSE, nf = 2)
s.class(pca2$ls, meaudret$plan$dat, sub = "Between dates Principal Component Analysis")
s.corcircle(pca1$co)
s.corcircle(pca2$as)
}
\keyword{datasets}

\eof
\name{mfa}
\alias{mfa}
\alias{print.mfa}
\alias{plot.mfa}
\alias{summary.mfa}
\title{Multiple Factorial Analysis}
\description{
performs a multiple factorial analysis, 
using an object of class \code{ktab}. 
}
\usage{
mfa(X, option = c("lambda1", "inertia", "uniform", "internal"), 
    scannf = TRUE, nf = 3)
plot.mfa (x, xax = 1, yax = 2, option.plot = 1:4, \dots) 
print.mfa (x, \dots) 
summary.mfa (object, \dots) 
}
\arguments{
  \item{X}{K-tables, an object of class \code{ktab}}
  \item{option}{a string of characters for the weighting of arrays options :
    \item{\code{lambda1}}{weighting of group k by the inverse of the first eigenvalue of the k analysis}
    \item{\code{inertia}}{weighting of group k by the inverse of the total inertia of the array k}
    \item{\code{uniform}}{uniform weighting of groups}
    \item{\code{internal}}{weighting included in \code{X$tabw}}
  }
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \item{x, object}{an object of class 'mfa'}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{option.plot}{an integer between 1 and 4, otherwise the 4 components of the plot are displayed}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
  Returns a list including :
  \item{tab}{a data frame with the modified array}
  \item{rank}{a vector of ranks for the analyses}
  \item{eig}{a numeric vector with the all eigenvalues}
  \item{li}{a data frame with the coordinates of rows}
  \item{TL}{a data frame with the factors associated to the rows (indicators of table)}
  \item{co}{a data frame with the coordinates of columns}
  \item{TC}{a data frame with the factors associated to the columns (indicators of table)}
  \item{blo}{a vector indicating the number of variables for each table}
  \item{lisup}{a data frame with the projections of normalized scores of rows for each table}
  \item{cg}{a data frame with the gravity center for the lisup}
  \item{link}{a data frame containing the projected inertia and the links between the arrays and the reference array}
  \item{corli}{a data frame giving the correlations between the \$lisup and the \$li}
}
\references{Escofier, B. and Pagès, J. (1994) Multiple factor analysis (AFMULT package), \emph{Computational Statistics and Data Analysis}, \bold{18}, 121--140.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(friday87)
w1 <- data.frame(scale(friday87$fau, scal = FALSE))
w2 <- ktab.data.frame(w1, friday87$fau.blo, 
    tabnames = friday87$tab.names)
mfa1 <- mfa(w2, scann = FALSE)
mfa1
plot(mfa1)

data(escopage)
w <- data.frame(scale(escopage$tab))
w <- ktab.data.frame(w, escopage$blo, tabnames = escopage$tab.names)
plot(mfa(w, scann = FALSE))
}
\keyword{multivariate}

\eof
\name{microsatt}
\alias{microsatt}
\docType{data}
\title{Genetic Relationships between cattle breeds with microsatellites}
\description{
This data set gives genetic relationships between cattle breeds with microsatellites. 
}
\usage{data(microsatt)}
\format{
    \code{microsatt} is a list of 4 components. 
    \describe{
        \item{tab}{contains the allelic frequencies for 18 cattle breeds (taurine or zebu,french or african) and 9 microsatellites.}
        \item{loci.names}{is a vector of the names of loci.}
        \item{loci.eff}{is a vector of the number of alleles per locus.}
        \item{alleles.names}{is a vector of the names of alleles.}
    }
}
\source{
Extract of data prepared by D. Laloe \email{ugendla@dga2.jouy.inra.fr} from data used in:

Moazami-Goudarzi, K., D. Laloe, J. P. Furet, and F. Grosclaude. 1997.
Analysis of genetic relationships between 10 cattle breeds with 17 microsatellites.
\emph{Animal Genetics}, \bold{28}, 338--345.

Souvenir Zafindrajaona, P.,Zeuh V. ,Moazami-Goudarzi K., Laloe D., Bourzat D., Idriss A., and Grosclaude F. (1999)
Etude du statut phylogénétique du bovin Kouri du lac Tchad à l'aide de marqueurs moléculaires.
\emph{Revue d'Elevage et de Médecine Vétérinaire des pays Tropicaux}, \bold{55}, 155--162.

Moazami-Goudarzi, K., Belemsaga D. M. A., Ceriotti G., Laloe D. , Fagbohoun F., Kouagou N. T., Sidibé I., Codjia V., Crimella M. C., Grosclaude F. and Touré S. M. (2001)\cr
Caractérisation de la race bovine Somba à l'aide de marqueurs moléculaires.
\emph{Revue d'Elevage et de Médecine Vétérinaire des pays Tropicaux}, \bold{54}, 1--10.
}
\examples{
\dontrun{
data(microsatt)
fac <- factor(rep(microsatt$loci.names, microsatt$loci.eff))
w <- dudi.coa(data.frame(t(microsatt$tab)), scann = FALSE)
wit <- within(w, fac, scann = FALSE)
microsatt.ktab <- ktab.within(wit)

plot(sepan(microsatt.ktab)) # 9 separated correspondence analyses
plot(mcoa(microsatt.ktab, scan = FALSE))
plot(mfa(microsatt.ktab, scan = FALSE))
plot(statis(microsatt.ktab, scan = FALSE))
}}
\keyword{datasets}

\eof
\name{mjrochet}
\alias{mjrochet}
\docType{data}
\title{Phylogeny and quantitative traits of teleos fishes}
\description{
This data set describes the phylogeny of 49 teleos fishes as reported by Rochet et al. (2000). It also gives life-history traits corresponding to these 49 species.
}
\usage{data(mjrochet)}
\format{
\code{mjrochet} is a list containing the 2 following objects : 
\describe{ 
   \item{tre}{is a character string giving the phylogenetic tree in Newick format.}
   \item{tab}{is a data frame with 49 rows and 7 traits.}  
}}
\details{        
 Variables of \code{mjrochet$tab} are the following ones : tm (age at maturity (years)), 
 lm (length at maturity (cm)), l05 (length at 5 per cent survival (cm)),
 t05 (time to 5 per cent survival (years)), fb (slope of the log-log fecundity-length relationship),
 fm (fecundity the year of maturity), egg (volume of eggs (\eqn{mm^{3}}{mm^3})).
}
\source{
Data taken from: \cr
    Summary of data - Clupeiformes : \url{http://www.ifremer.fr/maerha/clupe.html} \cr
    Summary of data - Argentiniformes : \url{http://www.ifremer.fr/maerha/argentin.html} \cr
    Summary of data - Salmoniformes : \url{http://www.ifremer.fr/maerha/salmon.html} \cr
    Summary of data - Gadiformes : \url{http://www.ifremer.fr/maerha/gadi.html} \cr
    Summary of data - Lophiiformes : \url{http://www.ifremer.fr/maerha/loph.html} \cr
    Summary of data - Atheriniformes : \url{http://www.ifremer.fr/maerha/ather.html} \cr
    Summary of data - Perciformes : \url{http://www.ifremer.fr/maerha/perci.html} \cr
    Summary of data - Pleuronectiformes : \url{http://www.ifremer.fr/maerha/pleuro.html} \cr
    Summary of data - Scorpaeniformes : \url{http://www.ifremer.fr/maerha/scorpa.html} \cr
    Phylogenetic tree : \url{http://www.ifremer.fr/maerha/life_history.html}
}
\references{
Rochet, M. J., Cornillon, P-A., Sabatier, R. and Pontier, D. (2000) 
Comparative analysis of phylogenic and fishing effects in life history patterns of teleos fishes.
\emph{Oïkos}, \bold{91}, 255--270.
}
\examples{
data(mjrochet)
mjrochet.phy <- newick2phylog(mjrochet$tre)
tab <- log((mjrochet$tab))
tab0 <- data.frame(scalewt(tab))
table.phylog(tab0, mjrochet.phy, csi = 2, clabel.r = 0.75)
orthogram(tab0[,1], ortho = mjrochet.phy$Bscores)
}
\keyword{datasets}

\eof
\name{mld}
\alias{mld}
\alias{haar2level}
\title{Multi Level Decomposition of unidimensional data}
\description{
The function \code{mld} performs an additive decomposition of the input vector \code{x} onto sub-spaces associated 
to an orthonormal orthobasis. The sub-spaces are defined by levels of the input factor \code{level}.
The function \code{haar2level} builds the factor \code{level} such that the multi level decomposition corresponds exactly to a multiresolution analysis performed with the haar basis.
}
\usage{
mld(x, orthobas, level, na.action = c("fail", "mean"),
 plot = TRUE, dfxy = NULL, phylog = NULL, ...)
haar2level(x)
}
\arguments{
  \item{x}{is a vector or a time serie containing the data to be decomposed. This must be a dyadic length vector (power of 2) for the function \code{haar2level}.}
  \item{orthobas}{is a data frame containing the vectors of the orthonormal basis.}
  \item{level}{is a factor which levels define the sub-spaces on which the function \code{mld} performs the additive decomposition.}
  \item{na.action}{ if 'fail' stops the execution of the current expression when \code{x} contains any missing value. If 'mean' replaces any missing values by mean(\code{x}).}
  \item{plot}{if TRUE plot \code{x} and the components resulting from the decomposition.}
  \item{dfxy}{is a data frame with two coordinates.}
  \item{phylog}{is an object of class \code{phylog}.}
  \item{\dots}{further arguments passed to or from other methods.}
}
\value{
A data frame with the components resulting from the decomposition.
}
\references{
Mallat, S. G. (1989) A theory for multiresolution signal decomposition: the wavelet representation. 
\emph{IEEE Transactions on Pattern Analysis and Machine Intelligence}, \bold{11}, 7, 674--693.

Percival, D. B. and Walden, A. T. (2000) \emph{Wavelet Methods for Time Series Analysis}, Cambridge University Press.
}
\author{Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}}
\seealso{\code{\link{gridrowcol}}, \code{\link{orthobasis}}, \code{\link{orthogram}}, \code{\link[waveslim]{mra}} for multiresolution analysis with various families of wavelets}
\examples{
\dontrun{
# decomposition of a time serie
data(co2)
x <- log(co2)
orthobas <- orthobasis.line(length(x))
level<-rep("D", 467)
level[1:3]<-rep("A", 3)
level[c(77,78,79,81)]<-rep("B", 4)
level[156]<-"C"
level<-as.factor(level)
res <- mld(x, orthobas, level)
sum(scale(x, scale = FALSE) - apply(res, 1, sum))
}
# decomposition of a biological trait on a phylogeny
data(palm)
vfruit<-palm$traits$vfruit
vfruit<-scalewt(vfruit)   
palm.phy<-newick2phylog(palm$tre)
level <- rep("F", 65)
level[c(4, 21, 3, 6, 13)] <- LETTERS[1:5]
level <- as.factor(level)
res <- mld(as.vector(vfruit), palm.phy$Bscores, level,
 phylog = palm.phy, clabel.nod = 0.7, f.phylog=0.8,
  csize = 2, clabel.row = 0.7, clabel.col = 0.7)
}
\keyword{ts}
\keyword{spatial}

\eof
\name{mollusc}
\alias{mollusc}
\docType{data}
\title{Faunistic Communities and Sampling Experiment}
\description{
This data set gives the abundance of 32 mollusk species in 163 samples. 
For each sample, 4 informations are known : the sampling sites, the seasons, 
the sampler types and the time of exposure. 
}
\usage{data(mollusc)}
\format{
    \code{mollusc} is a list of 2 objects.
    \describe{
    \item{fau}{is a data frame with 163 samples and 32 mollusk species (abundance).}
    \item{plan}{contains the 163 samples and 4 variables.}
    }
}
\source{
 Richardot-Coulet, M., Chessel D. and Bournaud M. (1986)
 Typological value of the benthos of old beds of a large river. Methodological approach.
 \emph{Archiv fùr Hydrobiologie}, \bold{107}, 363--383.
}
\examples{
data(mollusc)
coa1 <- dudi.coa(log(mollusc$fau + 1), scannf = FALSE, nf = 3)
par(mfrow = c(2,2))
s.chull(coa1$li, mollusc$plan$site, 2, 3, opt = 1, cpoi = 1)
s.chull(coa1$li, mollusc$plan$season, 2, 3, opt = 1, cpoi = 1)
s.chull(coa1$li, mollusc$plan$method, 2, 3, opt = 1, cpoi = 1)
s.chull(coa1$li, mollusc$plan$duration, 2, 3, opt = 1, cpoi = 1)
par(mfrow=c(1,1))}
\keyword{datasets}

\eof
\name{monde84}
\alias{monde84}
\docType{data}
\title{Global State of the World in 1984}
\usage{data(monde84)}
\description{
The \code{monde84} data frame gives five demographic variables 
for 48 countries in the world. 
}
\format{
  This data frame contains the following columns:
  \enumerate{
    \item{pib}{: Gross Domestic Product}
    \item{croipop}{: Growth of the population}
    \item{morta}{: Infant Mortality}
    \item{anal}{: Literacy Rate}
    \item{scol}{: Percentage of children in full-time education}
  }
}
\source{
Geze, F. and Coll., eds. (1984)
\emph{L'état du Monde 1984 : annuaire économique et géopolitique mondial}. La Découverte, Paris.
}
\examples{
data(monde84)
X <- cbind.data.frame(lpib = log(monde84$pib), monde84$croipop)
Y <- cbind.data.frame(lmorta = log(monde84$morta), 
    lanal = log(monde84$anal + 1), rscol = sqrt(100 - monde84$scol))
pcaY <- dudi.pca(Y, scan = FALSE)
pcaiv1 <- pcaiv(pcaY, X0 <- scale(X), scan = FALSE)
sum(cor(pcaiv1$l1[,1], Y0 <- scale(Y))^2)
pcaiv1$eig[1] #the same
}
\keyword{datasets}

\eof
\name{morphosport}
\alias{morphosport}
\docType{data}
\title{Athletes' Morphology}
\description{
This data set gives a morphological description of 153 athletes split in five different sports. 
 }
\usage{data(morphosport)}
\format{
\code{morphosport} is a list of 2 objects.
    \describe{
    \item{tab}{is a data frame with 153 athletes and 5 variables.}
    \item{sport}{is a factor with 6 items}
    }
}
\details{    
Variables of \code{morphosport$tab} are the following ones: dbi (biacromial diameter (cm)),
tde (height (cm)), tas (distance from the buttocks to the top of the head (cm)),
lms (length of the upper limbs (cm)), poids (weigth (kg)).\cr

The levels of \code{morphosport$sport} are: athl (athletics), foot (football),
hand (handball), judo, nata (swimming), voll (volleyball).
}
\source{
Mimouni , N. (1996) 
\emph{Contribution de méthodes biométriques à l'analyse de la morphotypologie des sportifs}. 
Thèse de doctorat. Université Lyon 1.
}
\examples{
data(morphosport)
plot(discrimin(dudi.pca(morphosport$tab, scan = FALSE), morphosport$sport, scan = FALSE))
}
\keyword{datasets}

\eof
\name{mstree}
\alias{mstree}
\title{ Minimal Spanning Tree }
\description{
  Minimal Spanning Tree
}
\usage{
mstree(xdist, ngmax = 1)
}
\arguments{
  \item{xdist}{ an object of class \code{dist} containing an observed dissimilarity }
  \item{ngmax}{ Component number (default=1). Select 1 for getting classical MST. To add n supplementary edges k times: select k+1. }
}
\value{
returns an object of class \code{neig}
}
\author{ Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} }
\examples{
data(mafragh)
maf.coa = dudi.coa(mafragh$flo, scan = FALSE)
maf.mst = mstree(dist.dudi(maf.coa), 1)
s.label(maf.coa$li, clab = 0, cpoi = 2, neig = maf.mst, cnei = 1)

xy = data.frame(x = runif(20), y = runif(20))
par(mfrow = c(2,2))
for (k in 1:4) {
    neig = mstree (dist.quant(xy,1), k)
    s.label(xy, xlim = c(0,1), ylim = c(0,1), addax = FALSE, neig = neig)
 }
}
\keyword{ utilities }

\eof
\name{multispati}
\alias{multispati}
\alias{plot.multispati}
\alias{summary.multispati}
\alias{print.multispati}
\title{Multivariate spatial analysis}
\description{
This function ensures a multivariate extension of the univariate method of spatial autocorrelation analysis.
By accounting for the spatial dependence of data observations and their multivariate covariance simultaneously, 
complex interactions among many variables are analysed. Using a methodological scheme borrowed from duality diagram 
analysis, a strategy for the exploratory analysis of spatial pattern in the multivariate is developped.
}
\usage{
multispati(dudi, listw, scannf = TRUE, nfposi = 2, nfnega = 0)
plot.multispati(x, xax = 1, yax = 2, ...) 
summary.multispati(object, ...) 
print.multispati(x, ...)
}
\arguments{
  \item{dudi}{an object of class \code{dudi} for the duality diagram analysis}
  \item{listw}{an object of class \code{listw} for the spatial dependence of data observations}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nfposi}{an integer indicating the number of kept positive axes}
  \item{nfnega}{an integer indicating the number of kept negative axes}
  \item{x, object}{an object of class \code{multispati}}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{\dots}{further arguments passed to or from other methods}
}
\details{
This analysis generalizes the Wartenberg's multivariate spatial
correlation analysis to various duality diagrams created by the
functions (\code{dudi.pca}, \code{dudi.coa}, \code{dudi.acm}, \code{dudi.mix}...)
If \emph{dudi} is a duality diagram created by the function \code{dudi.pca} 
and \emph{listw} gives spatial weights created by a row normalized coding scheme,
the analysis is equivalent to Wartenberg's analysis. 

We note X the data frame with the variables, Q the column weights matrix 
and D the row weights matrix associated to the duality diagram \emph{dudi}.
We note L the neighbouring weights matrix associated to  \emph{listw}.
Then, the \code{'multispati'} analysis gives principal axes v that maximize
the spatial autocorrelation : \deqn{I(XQv) = \frac{v^{t}Q^{t}X^{t}DLXQv}{v^{t}Q^{t}X^{t}DXQv}}{I(XQv) = t(v)t(Q)t(X)DLXQv / t(v)t(Q)t(X)DXQv}
}
\value{
Returns an object of class \code{multispati}.
}
\references{
Grunsky, E. C. and Agterberg, F. P. (1988) Spatial and multivariate analysis of geochemical data from metavolcanic rocks in the Ben Nevis area, Ontario. \emph{Mathematical Geology}, \bold{20}, 825--861.

Switzer, P. and Green, A.A. (1984) Min/max autocorrelation factors for multivariate spatial imagery. Tech. rep. 6, Stanford University.

Thioulouse, J., Chessel, D. and Champely, S. (1995) Multivariate analysis of spatial patterns: a unified approach to local and global structures. \emph{Environmental and Ecological Statistics}, \bold{2}, 1--14.

Wartenberg, D. E. (1985) Multivariate spatial correlation: a method for exploratory geographical analysis. \emph{Geographical Analysis}, \bold{17}, 263--283.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{dudi}},\code{\link[spdep]{listw}}}
\examples{
\dontrun{
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
    data(mafragh)
    maf.xy <- mafragh$xy
    maf.flo <- mafragh$flo
    maf.listw <- nb2listw(neig2nb(mafragh$neig))
    s.label(maf.xy, neig = mafragh$neig, clab = 0.75)
    maf.coa <- dudi.coa(maf.flo,scannf = FALSE)
    multispati.randtest(maf.coa, maf.listw)
    maf.coa.ms <- multispati(maf.coa, maf.listw, scannf = FALSE, nfposi = 2, nfnega = 2)
    summary(maf.coa.ms)
    par(mfrow = c(1,3))
    barplot(maf.coa$eig)
    barplot(maf.coa.ms$eig) 
    s.corcircle(maf.coa.ms$as)
 
    par(mfrow = c(2,2))
    s.value(maf.xy, -maf.coa$li[,1])
    s.value(maf.xy, -maf.coa$li[,2])
    s.value(maf.xy, maf.coa.ms$li[,1])
    s.value(maf.xy, maf.coa.ms$li[,2])
    par(mfrow = c(1,1))

    par(mfrow = c(1,2))
    w1 <- -maf.coa$li[,1:2]
    w1m <- apply(w1, 2, lag.listw, x = maf.listw)
    s.match(w1, w1m, clab = 0.75)
    w1.ms <- maf.coa.ms$li[,1:2]
    w1.msm <- apply(w1.ms, 2, lag.listw, x = maf.listw)
    s.match(w1.ms, w1.msm, clab = 0.75)
    par(mfrow = c(1,1))

    maf.pca <- dudi.pca(mafragh$mil, scannf = FALSE)
    multispati.randtest(maf.pca, maf.listw)
    maf.pca.ms <- multispati(maf.pca, maf.listw, scannf=FALSE)
    plot(maf.pca.ms)
}
}}
\keyword{multivariate}
\keyword{spatial}

\eof
\name{multispati.randtest}
\alias{multispati.randtest}
\title{Multivariate spatial autocorrelation test (in C)}
\description{
This function performs a multivariate autocorrelation test.
}
\usage{
multispati.randtest(dudi, listw, nrepet = 999)
}
\arguments{
  \item{dudi}{an object of class \code{dudi} for the duality diagram analysis}
  \item{listw}{an object of class \code{listw} for the spatial dependence of data observations}
  \item{nrepet}{the number of permutations}
}
\details{
We note X the data frame with the variables, Q the column weights matrix 
and D the row weights matrix associated to the duality diagram \emph{dudi}.
We note L the neighbouring weights matrix associated to  \emph{listw}.
This function performs a Monte-Carlo Test on the multivariate spatial 
autocorrelation index : \deqn{r = \frac{trace(X^{t}DLXQ)}{trace(X^{t}DXQ)}}{r = trace(t(X)DLXQ) / trace(t(X)DXQ)}
}
\value{
Returns an object of class \code{randtest} (randomization tests).
}
\references{
Smouse, P. E. and Peakall, R. (1999) Spatial autocorrelation analysis of individual multiallele and multilocus genetic structure. 
\emph{Heredity}, \bold{82}, 561--573.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{dudi}},\code{\link[spdep]{listw}}}
\examples{
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
    data(mafragh)
    maf.xy <- mafragh$xy
    maf.flo <- mafragh$flo
    maf.listw <- nb2listw(neig2nb(mafragh$neig))
    s.label(maf.xy, neig = mafragh$neig, clab = 0.75)
    maf.coa <- dudi.coa(maf.flo,scannf = FALSE)
    multispati.randtest(maf.coa, maf.listw)
}
}
\keyword{multivariate}
\keyword{spatial}
\keyword{nonparametric}

\eof
\name{multispati.rtest}
\alias{multispati.rtest}
\title{Multivariate spatial autocorrelation test}
\description{
This function performs a multivariate autocorrelation test.
}
\usage{
multispati.rtest(dudi, listw, nrepet = 99)
}
\arguments{
  \item{dudi}{an object of class \code{dudi} for the duality diagram analysis}
  \item{listw}{an object of class \code{listw} for the spatial dependence of data observations}
  \item{nrepet}{the number of permutations}
}
\details{
We note X the data frame with the variables, Q the column weight matrix 
and D the row weight matrix associated to the duality diagram \emph{dudi}.
We note L the neighbouring weights matrix associated to  \emph{listw}.
This function performs a Monte-Carlo Test on the multivariate spatial 
autocorrelation index : \deqn{r = \frac{X^{t}DLXQ}{X^{t}DXQ}}{r = t(X)DLXQ / t(X)DXQ}
}
\value{
Returns an object of class \code{randtest} (randomization tests).
}
\references{
Smouse, P. E. and Peakall, R. (1999) Spatial autocorrelation analysis of individual multiallele and multilocus genetic structure. 
\emph{Heredity}, \bold{82}, 561--573.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{dudi}},\code{\link[spdep]{listw}}}
\examples{
if(require(spdep, quiet = TRUE)){
    data(mafragh)
    maf.xy <- mafragh$xy
    maf.flo <- mafragh$flo
    maf.listw <- nb2listw(neig2nb(mafragh$neig))
    s.label(maf.xy, neig = mafragh$neig, clab = 0.75)
    maf.coa <- dudi.coa(maf.flo, scannf = FALSE)
    multispati.rtest(maf.coa, maf.listw)
}
}
\keyword{multivariate}
\keyword{spatial}
\keyword{nonparametric}

\eof
\name{neig}
\alias{neig}
\alias{neig.util.GtoL}
\alias{neig.util.LtoG}
\alias{print.neig}
\alias{summary.neig}
\alias{scores.neig}
\alias{nb2neig}
\alias{neig2nb}
\alias{neig2mat}
\title{Neighbourhood Graphs}
\description{
\code{neig} creates objects of class \code{neig} with : \cr
    a list of edges\cr
    a binary square matrix\cr
    a list of vectors of neighbours\cr
    an integer (linear and circular graphs)\cr
    a data frame of polygons (area)\cr

scores.neig returns the eigenvectors of neighbouring,\cr
orthonormalized scores (null average, unit variance 1/n and null covariances) of maximal autocorrelation.\cr

nb2neig returns an object of class \code{neig} using an object of class \code{nb} in the library 'spdep'

neig2nb returns an object of class \code{nb} using an object of class \code{neig}

neig2mat returns the incidence matrix between edges (1 = neighbour ; 0 = no neighbour)}

neig.util.GtoL and neig.util.LtoG are utilities.
}
\usage{
neig(list = NULL, mat01 = NULL, edges = NULL,
    n.line = NULL, n.circle = NULL, area = NULL)

scores.neig  (obj) 
print.neig  (x, \dots) 
summary.neig  (object, \dots)
nb2neig (nb)
neig2nb (neig)
neig2mat (neig)
}
\arguments{
\item{list}{a list which each component gives the number of neighbours}
\item{mat01}{a symmetric square matrix of 0-1 values}
\item{edges}{a matrix of 2 columns with integer values giving a list of edges}
\item{n.line}{the number of points for a linear plot}
\item{n.circle}{the number of points for a circular plot}
\item{area}{a data frame containing a polygon set (see \link{area.plot})}
\item{nb}{an object of class 'nb'}
\item{neig, x, obj, object}{an object of class 'neig'}
\item{\dots}{further arguments passed to or from other methods}
}
\references{
Thioulouse, J., D. Chessel, and S. Champely. 1995. 
Multivariate analysis of spatial patterns: a unified approach to local and global structures.
\emph{Environmental and Ecological Statistics}, \bold{2}, 1--14.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(mafragh)
if (require(tripack, quietly=TRUE)) {
    par(mfrow = c(2,1))
    provi <- neighbours(tri.mesh(mafragh$xy))
    provi.neig <- neig(list = provi)
    
    s.label(mafragh$xy, neig = provi.neig, inc = FALSE, 
        addax = FALSE, clab = 0, cnei = 2)
    dist <- apply(provi.neig, 1, function(x) 
        sqrt(sum((mafragh$xy[x[1],] - mafragh$xy[x[2],])^2)))
    #hist(dist, nclass = 50)
    mafragh.neig <- neig(edges = provi.neig[dist<50,])
    s.label(mafragh$xy, neig = mafragh.neig, inc = FALSE, 
        addax = FALSE, clab = 0, cnei = 2)
    par(mfrow = c(1,1))
    
    data(irishdata)
    irish.neig <- neig(area = irishdata$area)
      summary(irish.neig)
      print(irish.neig)
    s.label(irishdata$xy, neig = irish.neig, cneig = 3,
        area = irishdata$area, clab = 0.8, inc = FALSE)
    
    irish.scores <- scores.neig(irish.neig)
    par(mfrow = c(2,3))
    for (i in 1:6) s.value(irishdata$xy, irish.scores[,i],
        inc = FALSE, grid = FALSE, addax = FALSE,
        neig = irish.neig,
        csi = 2, cleg = 0, sub = paste("Eigenvector n°",i), csub = 2)
    par(mfrow = c(1,1))
    
    a.neig <- neig(n.circle = 16)
    a.scores <- scores.neig(a.neig)
    xy <- cbind.data.frame(cos((1:16) * pi / 8), sin((1:16) * pi / 8))
    par(mfrow = c(4,4))
    for (i in 1:15) s.value(xy, a.scores[,i], neig = a.neig, 
        csi = 3, cleg = 0)
    par(mfrow = c(1,1))
    
    a.neig <- neig(n.line = 28)
    a.scores <- scores.neig(a.neig)
    par(mfrow = c(7,4))
    par(mar = c(1.1,2.1,0.1,0.1))
    for (i in 1:27) barplot(a.scores[,i], col = grey(0.8))
}
par(mfrow = c(1,1))

if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
    data(columbus)
    par(mfrow = c(2,1))
    par(mar = c(0.1,0.1,0.1,0.1))
    plot(col.gal.nb, coords)
    s.label(data.frame(coords), neig = neig(list = col.gal.nb),
        inc = FALSE, clab = 0.6, cneig = 1)
    par(mfrow = c(1,1))
    
    data(mafragh)
    maf.rel <- relativeneigh(as.matrix(mafragh$xy))
    maf.rel <- graph2nb(maf.rel)
    s.label(mafragh$xy, neig = neig(list = maf.rel), inc = FALSE,
        clab = 0, addax = FALSE, cne = 1, cpo = 2)
    
    par(mfrow = c(2,2))
    w <- matrix(runif(100), 50, 2)
    x.gab <- gabrielneigh(w)
    x.gab <- graph2nb(x.gab)
    s.label(data.frame(w), neig = neig(list = x.gab), inc = FALSE,
        clab = 0, addax = FALSE, cne = 1, cpo = 2, sub = "relative")
    x.rel <- relativeneigh(w)
    x.rel <- graph2nb(x.rel)
    s.label(data.frame(w), neig = neig(list = x.rel), inc = FALSE,
        clab = 0, addax = FALSE, cne = 1, cpo = 2, sub = "Gabriel")
    k1 <- knn2nb(knearneigh(w))
    s.label(data.frame(w), neig = neig(list = k1), inc = FALSE,
        clab = 0, addax = FALSE, cne = 1, cpo = 2, sub = "k nearest neighbours")
    
    all.linked <- max(unlist(nbdists(k1, w)))
    z <- dnearneigh(w, 0, all.linked)
    s.label(data.frame(w), neig = neig(list = z), inc = FALSE,
        clab = 0, addax = FALSE, cne = 1, cpo = 2, 
        sub = "Neighbourhood contiguity by distance")
}
par(mfrow = c(1,1))
}
\keyword{utilities}

\eof
\name{newick.eg}
\alias{newick.eg}
\docType{data}
\title{Phylogenetic trees in Newick format}
\description{
This data set contains various exemples of phylogenetic trees in Newick format.
}
\usage{data(newick.eg)}
\format{
\code{newick.eg} is a list containing 14 character strings in Newick format. 
}
\source{
Trees 1 to 7 were obtained from the URL \cr 
\url{http://evolution.genetics.washington.edu/phylip/newicktree.html}. 

Trees 8 and 9 were obtained by Clémentine Carpentier-Gimaret \email{gimaret@biomserv.univ-lyon1.fr}. 

Tree 10 was obtained from Treezilla Data Sets starting from \cr \url{http://www.cis.upenn.edu/~krice/treezilla/}. 

Trees 11 and 12 are taken from Bauwens and Díaz-Uriarte (1997).

Tree 13 is taken from Cheverud and Dow (1985). 

Tree 13 is taken from Martins and Hansen (1997).
}
\references{
Bauwens, D. and Díaz-Uriarte, R. (1997) Covariation of life-history traits in lacertid lizards: a comparative study. 
\emph{American Naturalist}, \bold{149}, 91--111. 

Cheverud, J. and Dow, M.M. (1985) An autocorrelation analysis of genetic variation due to lineal fission in social groups of rhesus macaques. 
\emph{American Journal of Physical Anthropology}, \bold{67}, 113--122. 

Martins, E. P. and Hansen, T.F. (1997) Phylogenies and the comparative method: a general approach to incorporating phylogenetic information 
into the analysis of interspecific data. \emph{American Naturalist}, \bold{149}, 646--667.
}
\examples{
data(newick.eg)
newick2phylog(newick.eg[[11]])
radial.phylog(newick2phylog(newick.eg[[7]]), circ = 1,
 clabel.l = 0.75)
}
\keyword{datasets}

\eof
\name{newick2phylog}
\alias{newick2phylog}
\alias{hclust2phylog}
\alias{taxo2phylog}
\alias{newick2phylog.addtools}
\title{Create phylogeny}
\description{
The first three functions ensure to create object of class \code{phylog} from either a character string in Newick format (\code{newick2phylog}) or an object of class \code{'hclust'} (\code{hclust2phylog}) or a taxonomy (\code{taxo2phylog}).
The function \code{newick2phylog.addtools} is an internal function called by \code{newick2phylog}, \code{hclust2phylog} and \code{taxo2phylog} when \code{newick2phylog.addtools} = TRUE. It adds some items in \code{'phylog'} objects.
}
\usage{
newick2phylog(x.tre, add.tools = TRUE, call = match.call())
hclust2phylog(hc, add.tools = TRUE)
taxo2phylog(taxo, add.tools = TRUE)
newick2phylog.addtools(res, tol = 1e-07)
}
\arguments{
  \item{x.tre}{a character string corresponding to a phylogenetic tree in Newick format\cr
   (\url{http://evolution.genetics.washington.edu/phylip/newicktree.html})}
  \item{add.tools}{if TRUE, executes the function \code{newick2phylog.addtools}}
  \item{call}{call}
  \item{hc}{an object of class \code{hclust}}
  \item{taxo}{an object of class \code{taxo}}
  \item{res}{an object of class \code{phylog} (an internal argument of the function \code{newick2phylog})}
  \item{tol}{used in case 3 of \code{method} as a tolerance threshold for null eigenvalues}
}
\value{
Return object of class \code{phylog}.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{phylog}}, \code{\link{plot.phylog}}, \code{\link{as.taxo}}}
\examples{

 w <- "((((,,),,(,)),),(,));"
 w.phy <- newick2phylog(w)
 print(w.phy)
 plot(w.phy)

\dontrun{
# newick2phylog
data(newick.eg)
radial.phylog(newick2phylog(newick.eg[[8]], FALSE), cnode = 1,
 clabel.l = 0.8)

w <- NULL
w[1] <- "(,((((((((((((((((,,(,(,))),),(((,(,)),(,)),),(,(,)),(,)),((((("
w[2] <- ",(,)),),),(,)),((((,((,),((,(,)),))),(,)),(,(,),,((,),(,)),)),("
w[3] <- "(((((,),),(,(,))),),(,)),(((,),),)))),((,,((,),)),(,)),((,),(,)"
w[4] <- ")),(((((((((,,),),,),),((,),)),(,),((,),)),),(((((,),),),((,),)"
w[5] <- "),(((,(,(,(,)))),(,)),(((,),(((((((,),),),,),(,)),(,)),)),((,)"
w[6] <- ",))))),(,((,),(,)),((,(,)),)))),((((,(,(,))),((,(,)),,((,(,)),)"
w[7] <- ",)),(((,),),(((,),),))),((,),))),((((((((((,,,,(,)),),((,),)),("
w[8] <- ",(,))),(((((((((,(,)),(,)),((((,((,),(,(,(,))))),((,),(,(,)))),"
w[9] <- "),((,),))),(((((((((,(,)),((,),(,))),),),),(((,((,),)),),((,((,"
w[10] <- "),)),)),(,)),(,(,(,)))),((((,(,)),(,)),(((,),(,)),(,),,(,))),(,"
w[11] <- "))),(,,,))),((((,),),),(((,(,(,))),((,),)),(,)))),(,)),),(,((,("
w[12] <- ",)),),(((,),),))),),(((,),),(,),(,(,))),(((,),(,)),((,),(,)))),"
w[13] <- "(((,),((,),)),(((((,,,,,),(,)),(,)),(,((,),))),))),(,(((((,(((("
w[14] <- ",(,)),),),)),),((,((,),((,((,),(,))),))),)),((((,),(((,),(,(,))"
w[15] <- "),)),),)),((,),)))),(((,((,,((,),)),)),),((,),))),((,),(,))),(("
w[16] <- ",),)),(((((,),((,(,)),(((,(,)),(,(((,),),))),))),(,),,),),),,(,"
w[17] <- ")),((((,),,),),((,,,),((,),((,),))))),((((((,(,)),,(,)),,(,),(,"
w[18] <- "),),(((((,(,(,),)),(((,),,),(,))),),),),,,((,),)),),)),(((((,),"
w[19] <- "(,(,)),),((,((,),),,),)),(((((((,),((((,,,),(,(,))),(((,(,)),),"
w[20] <- "(,))),)),),),),(,)),),),((,),))),((,),)),(((((((((((,),),(((((("
w[21] <- ",),),((,),)),(,)),),)),(,)),),((((((,),),(((,),),)),(,)),),(,))"
w[22] <- ",),),),),(,)),),((,),(,),,,)),(,(,(,)))),),(,)),),);"
phy1 <- newick2phylog(w,FALSE)
phy1
radial.phylog(phy1, clabel.l = 0, circle = 2.2, clea = 0.5,
 cnod = 0.5)
data(newick.eg)
radial.phylog(newick2phylog(newick.eg[[8]], FALSE), cnode = 1,
 clabel.l = 0.8)

# hclust2phylog
data(USArrests)
hc <- hclust(dist(USArrests), "ave")
par(mfrow = c(1,2))
plot(hc, hang = -1)
phy <- hclust2phylog(hc)
plot.phylog(phy, clabel.l = 0.75, clabel.n = 0.6, f = 0.75)

par(mfrow = c(1,1))
row.names(USArrests) 
names(phy$leaves) #WARNING not the same for two reasons
row.names(USArrests) <- gsub(" ","_",row.names(USArrests))
row.names(USArrests) 
names(phy$leaves) #WARNING not the same for one reason
USArrests <- USArrests[names(phy$leaves),]
row.names(USArrests) 
names(phy$leaves) #the same
table.phylog(data.frame(scalewt(USArrests)), phy, csi = 2.5,
 clabel.r = 0.75, f = 0.7)

#taxo2phylog
data(taxo.eg)
tax <- as.taxo(taxo.eg[[1]])
tax.phy <- taxo2phylog(as.taxo(taxo.eg[[1]]))
par(mfrow = c(1,2))
plot.phylog(tax.phy, clabel.l = 1.25, clabel.n = 1.25, f = 0.75)
plot.phylog(taxo2phylog(as.taxo(taxo.eg[[1]][sample(15),])),
 clabel.l = 1.25, clabel.n = 1.25, f = 0.75)

par(mfrow=c(1,1))
plot.phylog(taxo2phylog(as.taxo(taxo.eg[[2]])), clabel.l = 1,
 clabel.n = 0.75, f = 0.65)
}}
\keyword{manip}

\eof
\name{niche}
\alias{niche}
\alias{plot.niche}
\alias{print.niche}
\title{Method to Analyse a pair of tables : Environmental and Faunistic Data}
\description{
performs a special multivariate analysis for ecological data. 
}
\usage{
niche(dudiX, Y, scannf = TRUE, nf = 2)
print.niche (x, \dots) 
plot.niche (x, xax = 1, yax = 2, \dots)
}
\arguments{
  \item{dudiX}{a duality diagram providing from a function \code{dudi.coa}, \code{dudi.pca}, ... using an array sites-variables}
  \item{Y}{a data frame sites-species according to \code{dudiX$tab} with no columns of zero}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \item{x}{an object of class \code{niche}}
  \item{\dots}{further arguments passed to or from other methods}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
}
\value{
Returns a list of the class \code{niche} (sub-class of \code{dudi}) containing :
 \item{rank}{an integer indicating the rank of the studied matrix}
 \item{nf}{an integer indicating the number of kept axes}
 \item{RV}{a numeric value indicating the RV coefficient}
 \item{eig}{a numeric vector with the all eigenvalues}
 \item{lw}{a data frame with the row weigths (crossed array)}
 \item{tab}{a data frame with the crossed array (averaging species/sites)}
 \item{li}{a data frame with the species coordinates}
 \item{l1}{a data frame with the species normed scores}
 \item{co}{a data frame with the variable coordinates}
 \item{c1}{a data frame with the variable normed scores}
 \item{ls}{a data frame with the site coordinates}
 \item{as}{a data frame with the axis upon niche axis} 
}
\references{
Dolédec, S., Chessel, D. and Gimaret, C. (2000) Niche separation in community analysis: a new method. \emph{Ecology}, \bold{81}, 2914--1927.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(doubs)
dudi1 <- dudi.pca(doubs$mil, scale = TRUE, scan = FALSE, nf = 3)
nic1 <- niche(dudi1, doubs$poi, scann = FALSE)

par(mfrow = c(2,2))
s.traject(dudi1$li, clab = 0)
s.traject(nic1$ls, clab = 0)
s.corcircle(nic1$as)
s.arrow(nic1$c1)

par(mfrow = c(5,6))
for (i in 1:27) s.distri(nic1$ls, as.data.frame(doubs$poi[,i]),
    csub = 2, sub = names(doubs$poi)[i])

par(mfrow = c(1,1))
s.arrow(nic1$li, clab = 0.7)

par(mfrow = c(1,1))
data(trichometeo)
pca1 <- dudi.pca(trichometeo$meteo, scan = FALSE)
nic1 <- niche(pca1, log(trichometeo$fau + 1), scan = FALSE)
plot(nic1)

data(rpjdl)
plot(niche(dudi.pca(rpjdl$mil, scan = FALSE), rpjdl$fau, scan = FALSE))
}
\keyword{multivariate}

\eof
\name{njplot}
\alias{njplot}
\docType{data}
\title{Phylogeny and trait of bacteria}
\description{
This data set describes the phylogenety of 36 bacteria as reported by Perrière and Gouy (1996). It also gives the GC rate corresponding to these 36 species.
}
\usage{data(njplot)}
\format{
\code{njplot} is a list containing the 2 following objects: \cr 
   \item{tre}{is a character string giving the fission tree in Newick format.} 
   \item{tauxcg}{is a numeric vector that gives the CG rate of the 36 species.}    
}
\source{
Data were obtained by Manolo Gouy \email{mgouy@biomserv.univ-lyon1.fr}
}
\references{
Perrière, G. and Gouy, M. (1996) WWW-Query : an on-line retrieval system for biological sequence banks. \emph{Biochimie}, \bold{78}, 364--369.
}
\examples{
data(njplot)
njplot.phy <- newick2phylog(njplot$tre)
par(mfrow = c(2,1))
tauxcg0 <- njplot$tauxcg - mean(njplot$tauxcg)
symbols.phylog(njplot.phy, squares = tauxcg0)
symbols.phylog(njplot.phy, circles = tauxcg0)
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{olympic}
\alias{olympic}
\docType{data}
\title{Olympic Decathlon}
\description{
This data set gives the performances of 33 men's decathlon in the 1988 Olympics
}
\usage{data(olympic)}
\format{
    \code{olympic} is a list of 2 components.
    \describe{
    \item{tab}{is a data frame with 33 rows and 10 columns events of the decathlon.}
    \item{scores}{is a vector of the final points scores of the competition.}
    }
}
\source{
Example 357 in: \cr
Hand, D.J., Daly, F., Lunn, A.D., McConway, K.J. and Ostrowski, E. (1994) 
\emph{A handbook of small data sets}, Chapman & Hall, London. 458 p.

Lunn, A. D. and McNeil, D.R. (1991) \emph{Computer-Interactive Data Analysis}, Wiley, New York
}
\examples{
data(olympic)
pca1 <- dudi.pca(olympic$tab, scan = FALSE)
par(mfrow = c(2,2))
barplot(pca1$eig)
s.corcircle(pca1$co)
plot(olympic$score, pca1$l1[,1])
abline(lm(pca1$l1[,1]~olympic$score))
s.label(pca1$l1, clab = 0.5)
s.arrow(2 * pca1$co, add.p = TRUE)
par(mfrow = c(1,1))}
\keyword{datasets}

\eof
\name{oribatid}
\alias{oribatid}
\docType{data}
\title{Oribatid mite}
\description{
This data set contains informations about environmental control and spatial structure in ecological communities of Oribatid mites.
}
\usage{data(oribatid)}
\format{
\code{oribatid} is a list containing the following objects : 
\describe{
        \item{fau}{: a data frame with 70 rows (sites) and 35 columns (Oribatid species)}   
        \item{envir}{: a data frame with 70 rows (sites) and 5 columns (environmental variables)}
        \item{xy}{: a data frame that contains spatial coordinates of the 70 sites}
}}
\details{
Variables of \code{oribatid$envir} are the following ones : \cr
substrate: a factor with seven levels that describes the nature of the substratum\cr
shrubs: a factor with three levels that describes the absence/presence of shrubs\cr
topo: a factor with two levels that describes the microtopography\cr
density: substratum density (\eqn{g.L^{-1}}{g.L^-1})\cr
water: water content of the substratum (\eqn{g.L^{-1}}{g.L^-1})
}
\source{
Data prepared by P. Legendre \email{Pierre.Legendre@umontreal.ca} and \cr
D. Borcard \email{borcardd@magellan.umontreal.ca} starting from \cr
\url{http://www.fas.umontreal.ca/biol/casgrain/fr/labo/oribates.html}
}
\references{
Borcard, D., and Legendre, P. (1994) Environmental control and spatial structure in ecological communities: an example using Oribatid mites (\emph{Acari Oribatei}). \emph{Environmental and Ecological Statistics}, \bold{1}, 37--61.

Borcard, D., Legendre, P., and Drapeau, P. (1992) Partialling out the spatial component of ecological variation. \emph{Ecology}, \bold{73}, 1045--1055.
}
\examples{
data(oribatid)
ori.xy <- oribatid$xy[,c(2,1)]
names(ori.xy) <- c("x","y")
plot(ori.xy,pch = 20, cex = 2, asp = 1)

if (require(tripack, quiet = TRUE)) {
  if (require(spdep, quiet = TRUE)) {
    plot(voronoi.mosaic(ori.xy), add = TRUE)
    s.label(ori.xy, add.p = TRUE,
     neig = nb2neig(knn2nb(knearneigh(as.matrix(ori.xy), 3))),
     clab = 0)
    }
  }
}
\keyword{datasets}

\eof
\name{orthobasis}
\alias{orthobasis}
\alias{orthobasis.neig}
\alias{orthobasis.line}
\alias{orthobasis.circ}
\alias{orthobasis.mat}
\alias{orthobasis.listw}
\alias{orthobasis.haar}
\alias{print.orthobasis}

\title{Orthonormal basis for orthonormal transform}
\description{
These functions returns object of class \code{'orthobasis'} that contains data frame with \emph{n} rows and \emph{n-1} columns.
Each data frame defines an orthonormal basis for the uniform weights.

\code{orthobasic.neig} returns the eigen vectors of the matrix N-M where M is the symmetric \emph{n} by \emph{n} matrix of the between-sites neighbouring graph and N is the diagonal matrix of neighbour numbers. \cr
\code{orthobasis.line} returns the analytical solution for the linear neighbouring graph. \cr
\code{orthobasic.circ} returns the analytical solution for the circular neighbouring graph. \cr
\code{orthobsic.mat} returns the eigen vectors of the general link matrix M. \cr
\code{orthobasis.listw} returns the eigen vectors of the general link matrix M associated to a \code{listw} object. \cr
\code{orthobasis.haar} returns wavelet haar basis. 
}
\usage{
orthobasis.neig(neig)
orthobasis.line(n)
orthobasis.circ(n)
orthobasis.mat(mat, cnw=TRUE)
orthobasis.listw(listw)
orthobasis.haar(n)
print.orthobasis(x,...)
}
\arguments{
  \item{neig}{is an object of class \code{neig}}
  \item{n}{is an integer that defines length of vectors}
  \item{mat}{is a \emph{n} by \emph{n} phylogenetic or spatial link matrix}
  \item{listw}{is a \code{'listw'} object}
  \item{cnw}{if TRUE, the matrix of the neighbouring graph is modified to give Constant Neighbouring Weights}
  \item{x}{is an object of class \code{orthobasis}}
  \item{\dots}{: further arguments passed to or from other methods}
}
\value{
All the functions excepted \code{print.ortobasis} return an object of class \code{orthobasis} containing a data frame.
This data frame defines an orthonormal basis with \emph{n-1} vectors of length \emph{n}. Various attributes are associated to it : \cr
  \item{names}{: names of the vectors}
  \item{row.names}{: row names of the data frame}
  \item{class}{: class}
  \item{values}{: row weights (uniform weights)}
  \item{weights}{: numeric values to class vectors according to their quadratic forms (Moran ones)}
  \item{call}{: call}
}
\references{
Misiti, M., Misiti, Y., Oppenheim, G. and Poggi, J.M. (1993) Analyse de signaux classiques par décomposition en ondelettes. 
\emph{Revue de Statistique Appliquée}, \bold{41}, 5--32.

Cornillon, P.A. (1998) \emph{Prise en compte de proximités en analyse factorielle et comparative}.
Thèse, Ecole Nationale Supérieure Agronomique, Montpellier.
}
\author{Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr} \cr
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\note{the function \code{orthobasis.haar} uses function \code{\link[waveslim]{wavelet.filter}} from package waveslim.}
\seealso{\code{\link{gridrowcol}} that defines an orthobasis for square grid, \code{\link{phylog}} that defines an orthobasis for phylogenetic tree, \code{\link{orthogram}} and \code{\link{mld}}}
\examples{

# a 2D spatial orthobasis
par(mfrow = c(4,4))
w <- gridrowcol(8,8)
 for (k in 1:16)
    s.value(w$xy, w$orthobasis[,k], cleg = 0, csi = 2, incl = FALSE,
     addax = FALSE, sub = k, csub = 4, ylim = c(0,10), cgri = 0)
par(mfrow = c(1,1))
barplot(attr(w$orthobasis, "values"))

# Haar 1D orthobasis
w <- orthobasis.haar(32)
par(mfrow = c(8,4))
par(mar = c(0.1,0.1,0.1,0.1))
 for (k in 1:31) {
    plot(w[,k], type="S",xlab = "", ylab = "", xaxt = "n",
     yaxt = "n", xaxs = "i", yaxs = "i",ylim=c(-4.5,4.5))
    points(w[,k], type = "p", pch = 20, cex = 1.5)
}

# a 1D orthobasis
w <- orthobasis.line(n = 33)
par(mfrow = c(8,4))
par(mar = c(0.1,0.1,0.1,0.1))
 for (k in 1:32) {
    plot(w[,k], type="l",xlab = "", ylab = "", xaxt = "n",
     yaxt = "n", xaxs = "i", yaxs = "i",ylim=c(-1.5,1.5))
    points(w[,k], type = "p", pch = 20, cex = 1.5)
}

par(mfrow = c(1,1))
barplot(attr(w, "values"))

w <- orthobasis.circ(n = 26)
#par(mfrow = c(5,5))
#par(mar = c(0.1,0.1,0.1,0.1))
# for (k in 1:25) 
#    dotcircle(w[,k], xlim = c(-1.5,1.5), cleg = 0)

par(mfrow = c(1,1))
#barplot(attr(w, "values"))

\dontrun{
# a spatial orthobasis
data(mafragh)
w <- orthobasis.neig(mafragh$neig)
par(mfrow = c(4,2))
for (k in 1:8)
    s.value(mafragh$xy, w[,k],cleg = 0, sub = as.character(k),
     csub = 3)

par(mfrow = c(1,1))
barplot(attr(w, "values"))

# a phylogenetic orthobasis
data(njplot)
phy <- newick2phylog(njplot$tre)
wA <- phy$Ascores
wW <- phy$Wscores
table.phylog(phylog = phy, wA, clabel.row = 0, clabel.col  = 0.5)
table.phylog(phylog = phy, wW, clabel.row = 0, clabel.col  = 0.5)

}}
\keyword{spatial}
\keyword{ts}

\eof
\name{orthogram}
\alias{orthogram}
\title{Orthonormal decomposition of variance}
\description{
This function performs the orthonormal decomposition of variance of a quantitative variable on an orthonormal basis. It also returns the results of five non parametric tests associated to the variance decomposition. 
It thus provides tools (graphical displays and test) for analysing phylogenetic, spatial and temporal pattern of one quantitative variable.
}
\usage{
orthogram(x, orthobas = NULL, neig = NULL, phylog = NULL,
     nrepet = 999, posinega = 0, tol = 1e-07, na.action = c("fail",
     "mean"), cdot = 1.5, cfont.main = 1.5, lwd = 2, nclass,
     high.scores = 0)
}
\arguments{
  \item{x}{a numeric vector corresponding to the quantitative variable}
  \item{orthobas}{an object of class \code{'orthobasis'}}
  \item{neig}{an object of class \code{'neig'}}
  \item{phylog}{an object of class \code{'phylog'}}
  \item{nrepet}{an integer giving the number of permutations}
  \item{posinega}{a parameter for the ratio test. If posinega > 0, the function computes the ratio test.}
  \item{tol}{a tolerance threshold for orthonormality condition}
  \item{na.action}{if 'fail' stops the execution of the current expression when \code{z} contains any missing value. If 'mean' replaces any missing values by mean(\code{z})}
  \item{cdot}{a character size for points on the cumulative decomposition display}
  \item{cfont.main}{a character size for titles}
  \item{lwd}{a character size for dash lines}
  \item{nclass}{a single number giving the number of cells for the histogram}
  \item{high.scores}{a single number giving the number of vectors to return. If > 0, the function returns labels of vectors that explains the larger part of variance.}
}
\details{
The function computes the variance decomposition of a quantitative vector x on an orthonormal basis B. The variable is normalized given the uniform weight to eliminate problem of scales.
It plots the squared correlations \eqn{R^{2}}{R^2} between x and vectors of B (variance decomposition) and the cumulated squared correlations \eqn{SR^{2}}{SR^2} (cumulative decomposition).
The function also provides five non parametric tests to test the existence of autocorrelation. The tests derive from the five following statistics :
    \item{R2Max}{=\eqn{\max(R^{2})}{max(R^2)}. It takes high value when a high part of the variability is explained by one score.}
    \item{SkR2k}{=\eqn{\sum_{i=1}^{n-1}(iR^{2}_i)}{sum_i i*(R^2)_i}. It compares the part of variance explained by internal nodes to the one explained by end nodes.}
    \item{Dmax}{=\eqn{\max(SR^{2}_j - SR^{2}_{j-1})}{max((SR^2)_j - (SR^2)_(j-1))}. It examines the accumulation of variance for a sequence of scores.}
    \item{SCE}{=\eqn{\sum_{i=1}^{n-1} (SR^{2}_i - SR^{2}_{i-1})^{2}}{sum_i ((SR^2)_i - (SR^2)_(i-1))^2}. It examines also the accumulation of variance for a sequence of scores.}
    \item{ratio}{depends of the parameter posinega. If posinega > 0, the statistic ratio exists and equals \eqn{\sum_{i=1}^{posinega}R^{2}_i}{sum_i (R^2)_i with i < posinega + 1}. It compares the part of variance explained by internal nodes to the one explained by end nodes when we can define how many vectors correspond to internal nodes.}
}
\value{
If (high.scores = 0), returns an object of class \code{'krandtest'} (randomization tests) corresponding to the five non parametric tests. \cr \cr
If (high.scores > 0), returns a list containg : 
    \item{w}{: an object of class \code{'krandtest'} (randomization tests)}
    \item{scores.order}{: a vector which terms give labels of vectors that explain the larger part of variance}   
}
\references{
Ollier, S., Chessel, D. and Couteron, P. (submitted) Orthonormal transform to detect and  describe phylogenetic autocorrelation. \emph{Biometrics}.
}
\author{Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr} \cr
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{gridrowcol}}, \code{\link{orthobasis}}, \code{\link{mld}}}
\examples{
# a phylogenetic example
data(ungulates)
ung.phy <- newick2phylog(ungulates$tre)
FemBodyMass <- log(ungulates$tab[,1])
NeonatBodyMass <- log((ungulates$tab[,2]+ungulates$tab[,3])/2)
plot(FemBodyMass,NeonatBodyMass, pch = 20, cex = 2)
abline(lm(NeonatBodyMass~FemBodyMass))
z <- residuals(lm(NeonatBodyMass~FemBodyMass))
dotchart.phylog(ung.phy,val = z, clabel.n = 1,
     labels.n = ung.phy$Blabels, cle = 1.5, cdot = 2)
table.phylog(ung.phy$Bscores, ung.phy,clabel.n = 1,
     labels.n = ung.phy$Blabels)
orthogram(z, ung.phy$Bscores)
orthogram(z, phyl=ung.phy) # the same thing

# a spatial example
data(irishdata)
neig1 <- neig(mat01 = 1*(irishdata$link > 0))
sco1 <- scores.neig(neig1)
z <- scalewt(irishdata$tab$cow)
orthogram(z, sco1)

# a temporal example
data(arrival)
w <- orthobasis.circ(24)
orthogram(arrival$hours, w)
par(mfrow = c(1,2))
dotcircle(arrival$hours)
dotcircle(w[,2])
par(mfrow = c(1,1))

data(lynx)
ortho <- orthobasis.line(114)
orthogram(lynx,ortho)
attributes(lynx)$tsp
par(mfrow = c(2,1))
par(mar = c(4,4,2,2))
plot.ts(lynx)
plot(ts(ortho[,23], start = 1821, end = 1934, freq = 1), ylab = "score 23")
par(mfrow = c(1,1))
}
\keyword{spatial}
\keyword{ts}

\eof
\name{ours}
\alias{ours}
\docType{data}
\title{A table of Qualitative Variables}
\usage{data(ours)}
\description{
The \code{ours} (bears) data frame has 38 rows, areas of the "Inventaire National Forestier", and 10 columns.
}
\format{
  This data frame contains the following columns:
   \enumerate{
    \item{altit}{importance of the altitudinal area inhabited by bears, a factor with levels: 
    \code{1} less than 50\% of the area between 800 and 2000 meters 
        \code{2} between 50 and 70\% 
        \code{3} more than 70\%} 
        
    \item{deniv}{importance of the average variation in level by square of 50 km2, a factor with levels: 
        \code{1} less than 700m
        \code{2} between 700 and 900 m 
        \code{3} more than 900 m }
        
    \item{cloiso}{partitioning of the massif, a factor with levels: 
        \code{1} a great valley or a ridge isolates at least a quarter of the massif 
        \code{2} less than a quarter of the massif is isolated 
        \code{3} the massif has no split}
        
    \item{domain}{importance of the national forests on contact with the massif, a factor with levels: 
        \code{1} less than 400  km2 
        \code{2} between 400 and 1000  km2 
        \code{3} more than 1000  km2 }
        
    \item{boise}{rate of afforestation, a factor with levels: 
        \code{1} less than 30\% 
        \code{2} between 30 and 50\% 
    \code{3} more than 50\% }
    
    \item{hetra}{importance of plantations and mixed forests, a factor with levels: 
        \code{1} less than 5\% 
        \code{2} between 5 and 10\% 
        \code{3} more than 10\% of the massif }
        
    \item{favor}{importance of favorable forests, plantations, mixed forests, fir plantations, a factor with levels: 
        \code{1} less than 5\% 
        \code{2} between 5 and 10\% 
    \code{3} more than 10\% of the massif }
        
    \item{inexp}{importance of unworked forests, a factor with levels: 
        \code{1} less than 4\% 
        \code{2} between 4 and 8\% 
        \code{3} more than 8\% of the total area }
        
    \item{citat}{presence of the bear before its disappearance, a factor with levels: 
        \code{1} no quotation since 1840 
        \code{2} 1 to 3 quotations before 1900 and none after 
        \code{3} 4 quotations before 1900 and none after 
        \code{4} at least 4 quotations before 1900 and at least 1 quotation between 1900 and 1940 }
        
    \item{depart}{district, a factor with levels: 
        \code{AHP} Alpes-de-Haute-Provence 
        \code{AM} Alpes-Maritimes 
        \code{D} Drôme 
        \code{HP} Hautes-Alpes 
        \code{HS} Haute-Savoie 
        \code{I} Is"re 
        \code{S} Savoie }
  }
}
\source{
 Erome, G. (1989) \emph{L'ours brun dans les Alpes françaises. Historique de sa disparition}.
 Centre Ornithologique Rhône-Alpes, Villeurbanne. 120 p.
}
\examples{
data(ours)
boxplot(dudi.acm(ours, scan = FALSE))
}
\keyword{datasets}

\eof
\name{palm}
\alias{palm}
\docType{data}
\title{Phylogenetic and quantitative traits of amazonian palm trees}
\description{
This data set describes the phylogeny of 66 amazonian palm trees. It also gives 7 traits corresponding to these 66 species.
}
\usage{data(palm)}
\format{
\code{palm} is a list containing the 2 following objects: 
\describe{ 
   \item{tre}{is a character string giving the phylogenetic tree in Newick format.} 
   \item{traits}{is a data frame with 66 species (rows) and 7 traits (columns).}
} }
\details{       
Variables of \code{palm$traits} are the following ones: \cr
rord: specific richness with five ordered levels\cr
h: height in meter (squared transform)\cr
dqual: diameter at breast height in centimeter with five levels \code{sout : subterranean}, \code{ d1(0, 5 cm)}, \code{ d2(5, 15 cm)}, \code{ d3(15, 30 cm)} and \code{ d4(30, 100 cm)}\cr
vfruit: fruit volume in \eqn{mm^{3}}{mm^3} (logged transform)\cr
vgrain: seed volume in \eqn{mm^{3}}{mm^3} (logged transform)\cr
aire: spatial distribution area (\eqn{km^{2}}{km^2})\cr
alti: maximum altitude in meter (logged transform)\cr       
}
\source{
This data set was obtained by Clémentine Gimaret-Carpentier\cr
 \email{gimaret@biomserv.univ-lyon1.fr}.
}
\examples{
\dontrun{
data(palm)
palm.phy <- newick2phylog(palm$tre)
radial.phylog(palm.phy,clabel.l=1.25)

orthogram(palm$traits[,4],palm.phy$Bscores)
dotchart.phylog(palm.phy,palm$traits[,4], clabel.l = 1,
 labels.n = palm.phy$Blabels, clabel.n = 0.75)
w <- cbind.data.frame(palm.phy$Bscores[,c(3,4,6,13,21)],
 scalewt((palm$traits[,4])))
names(w)[6] <- names(palm$traits[4])
table.phylog(w, palm.phy, clabel.r = 0.75, f = 0.5)

gearymoran(palm.phy$Amat, palm$traits[,-c(1,3)])
}}
\keyword{datasets}

\eof
\name{pap}
\alias{pap}
\docType{data}
\title{Taxonomy and quantitative traits of carnivora}
\description{
This data set describes the taxonomy of 39 carnivora. It also gives life-history traits corresponding to these 39 species.
}
\usage{data(pap)}
\format{
\code{pap} is a list containing the 2 following objects : 
\describe{ 
   \item{taxo}{is a data frame with 39 species and 3 columns.} 
   \item{tab}{is a data frame with 39 species and 4 traits.}    
 }}
\details{       
Variables of \code{pap$tab} are the following ones : genre (genus with 30 levels),
famille (family with 6 levels), superfamille (superfamily with 2 levels).\cr

Variables of \code{pap$tab} are Group Size, Body Weight, Brain Weight, Litter Size.
}
\source{
Data taken from the phylogenetic autocorrelation package starting from:\cr
 \url{http://www.ent.orst.edu/pa/demopa.asp}.
}
\examples{
data(pap)
taxo <- taxo2phylog(as.taxo(pap$taxo))
table.phylog(scalewt(pap$tab), taxo, csi = 2, clabel.nod = 0.6,
 f.phylog = 0.6)
}
\keyword{datasets}

\eof
\name{pcaiv}
\alias{pcaiv}
\alias{plot.pcaiv}
\alias{print.pcaiv}
\title{Principal component analysis with respect to instrumental variables}
\description{
performs a principal component analysis with respect to instrumental variables. 
}
\usage{
pcaiv(dudi, df, scannf = TRUE, nf = 2)
plot.pcaiv (x, xax = 1, yax = 2, \dots) 
print.pcaiv (x, \dots) 
}
\arguments{
  \item{dudi}{a duality diagram, object of class \code{dudi}}
  \item{df}{a data frame with the same rows}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \cr
  \item{x}{an object of class \code{pcaiv}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns an object of class \code{pcaiv}, sub-class of class \code{dudi}
  \item{rank}{an integer indicating the rank of the studied matrix}
  \item{nf}{an integer indicating the number of kept axes}
  \item{eig}{a vector with the all eigenvalues}
  \item{lw}{a numeric vector with the row weigths (from \code{dudi})}
  \item{cw}{a numeric vector with the column weigths (from \code{dudi})}
  \item{Y}{a data frame with the dependant variables}
  \item{X}{a data frame with the explanatory variables}
  \item{tab}{a data frame with the modified array (projected variables)}
  \item{c1}{a data frame with the Pseudo Principal Axes (PPA)}
  \item{as}{a data frame with the Principal axes of \code{dudi$tab} on PPA}
  \item{ls}{a data frame with the projections of lines of \code{dudi$tab} on PPA}
  \item{li}{a data frame \code{dudi$ls} with the predicted values by X}
  \item{fa}{a data frame with the loadings (Constraint Principal Components as linear combinations of X}
  \item{l1}{data frame with the Constraint Principal Components (CPC)}
  \item{co}{a data frame with the inner products between the CPC and Y}
  \item{cor}{a data frame with the correlations between the CPC and X }
}
\references{
Rao, C. R. (1964) The use and interpretation of principal component analysis in applied research. \emph{Sankhya}, \bold{A 26}, 329--359.\cr\cr
Obadia, J. (1978) L'analyse en composantes explicatives. \emph{Revue de Statistique Appliquée}, \bold{24}, 5--28.\cr\cr
Lebreton, J. D., Sabatier, R., Banco G. and  Bacou A. M. (1991) Principal component and correspondence analyses with respect to instrumental variables : an overview of their role in studies of structure-activity and species- environment relationships. In J. Devillers and W. Karcher, editors. \emph{Applied Multivariate Analysis in SAR and Environmental Studies}, Kluwer Academic Publishers, 85--114 
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(rhone)
pca1 <- dudi.pca(rhone$tab, scan = FALSE, nf = 3)
iv1 <- pcaiv(pca1, rhone$disch, scan = FALSE)
iv1
# iner inercum inerC inercumC ratio R2    lambda
# 6.27 6.27    5.52  5.52     0.879 0.671 3.7   
# 4.14 10.4    4.74  10.3     0.984 0.747 3.54  
plot(iv1)
}
\keyword{multivariate}

\eof
\name{pcaivortho}
\alias{pcaivortho}
\title{Principal Component Analysis with respect to orthogonal instrumental variables}
\description{
performs a Principal Component Analysis with respect to orthogonal instrumental variables. 
}
\usage{
pcaivortho(dudi, df, scannf = TRUE, nf = 2)
}
\arguments{
  \item{dudi}{a duality diagram, object of class \code{dudi}}
  \item{df}{a data frame with the same rows}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
an object of class 'pcaivortho' sub-class of class \code{dudi}
  \item{rank}{an integer indicating the rank of the studied matrix}
  \item{nf}{an integer indicating the number of kept axes}
  \item{eig}{a vector with the all eigenvalues}
  \item{lw}{a numeric vector with the row weigths (from \code{dudi})}
  \item{cw}{a numeric vector with the column weigths (from \code{dudi})}
  \item{Y}{a data frame with the dependant variables}
  \item{X}{a data frame with the explanatory variables}
  \item{tab}{a data frame with the modified array (projected variables)}
  \item{c1}{a data frame with the Pseudo Principal Axes (PPA)}
  \item{as}{a data frame with the Principal axis of \code{dudi$tab} on PAP}
  \item{ls}{a data frame with the projection of lines of \code{dudi$tab} on PPA}
  \item{li}{a data frame \code{dudi$ls} with the predicted values by X}
  \item{l1}{a data frame with the Constraint Principal Components (CPC)}
  \item{co}{a data frame with the inner product between the CPC and Y}
  \item{param}{a data frame containing a summary}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\references{
Rao, C. R. (1964) The use and interpretation of principal component analysis in applied research. \emph{Sankhya}, \bold{A 26}, 329--359.\cr\cr
Sabatier, R., Lebreton J. D. and Chessel D. (1989) Principal component analysis with instrumental variables as a tool for modelling composition data. In R. Coppi and S. Bolasco, editors. \emph{Multiway data analysis}, Elsevier Science Publishers B.V., North-Holland, 341--352
}
\examples{
\dontrun{
par(mfrow = c(2,2))
data(avimedi)
cla <- avimedi$plan$reg:avimedi$plan$str

# simple ordination
coa1 <- dudi.coa(avimedi$fau, scan = FALSE, nf = 3)
s.class(coa1$li, cla, sub = "Sans contrainte")

# within region
w1 <- within(coa1, avimedi$plan$reg, scan = FALSE)
s.match(w1$li, w1$ls, clab = 0, sub = "Intra Région")
s.class(w1$li, cla, add.plot = TRUE)

# no region the same result
pcaivnonA <- pcaivortho(coa1, avimedi$plan$reg, scan = FALSE)
s.match(pcaivnonA$li, pcaivnonA$ls, clab = 0, 
    sub = "Contrainte Non A")
s.class(pcaivnonA$li, cla, add.plot = TRUE)

# region + strate
interAplusB <- pcaiv(coa1, avimedi$plan, scan = FALSE)
s.match(interAplusB$li, interAplusB$ls, clab = 0, 
    sub = "Contrainte A + B")
s.class(interAplusB$li, cla, add.plot = TRUE)

par(mfrow = c(1,1))}}
\keyword{multivariate}

\eof
\name{pcoscaled}
\alias{pcoscaled}
\title{Simplified Analysis in Principal Coordinates}
\description{
performs a simplified analysis in principal coordinates, 
using an object of class \code{dist}. 
}
\usage{
pcoscaled(distmat, tol = 1e-07)
}
\arguments{
  \item{distmat}{an object of class \code{dist}}
  \item{tol}{a tolerance threshold, an eigenvalue is considered as positive if it is larger than \code{-tol*lambda1} where \code{lambda1} is the largest eigenvalue}
}
\value{
returns a data frame containing the Euclidean representation of the distance matrix with a total inertia equal to 1
}
\references{Gower, J. C. (1966) Some distance properties of latent root and vector methods used in multivariate analysis. \emph{Biometrika}, \bold{53}, 325--338.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
library(mva)
    a <- 1 / sqrt(3) - 0.2
    w <- matrix(c(0,0.8,0.8,a,0.8,0,0.8,a,
        0.8,0.8,,0,a,a,a,a,0),4,4)
    w <- as.dist(w)
    w <- cailliez(w)
    w
    pcoscaled(w)
    dist(pcoscaled(w)) # w
    dist(pcoscaled(2 * w)) # the same
    sum(pcoscaled(w)^2) # unity
}
\keyword{array}

\eof
\name{perthi02}
\alias{perthi02}
\docType{data}
\title{Contingency Table with a partition in Molecular Biology}
\description{
This data set gives the amino acids of 904 proteins 
distributed in three classes. 
}
\usage{data(perthi02)}
\format{
    \code{perthi02} is a list of 2 components.
    \describe{
    \item{tab}{is a data frame 904 rows (proteins of 201 species) 20 columns (amino acids).}
    \item{cla}{is a factor of 3 classes of protein}
    }
The levels of \code{perthi02$cla} are \code{cyto} (cytoplasmic proteins) \code{memb} (integral membran proteins) \code{peri} (periplasmic proteins)
}
\source{
Perriere, G. and Thioulouse, J. (2002) 
Use of Correspondence Discriminant Analysis to predict the subcellular location of bacterial proteins. 
\emph{Computer Methods and Programs in Biomedicine}, \bold{70}, 2, 99--105.
}
\examples{
data(perthi02)
plot(discrimin.coa(perthi02$tab, perthi02$cla, scan = FALSE))
}
\keyword{datasets}

\eof
\name{phylog}
\alias{phylog}
\alias{print.phylog}
\alias{phylog.extract}
\alias{phylog.permut}
\title{Phylogeny}
\description{
Create and use objects of class \code{phylog}. \cr
\code{phylog.extract} returns objects of class \code{phylog}. It extracts sub-trees from a tree. \cr
\code{phylog.permut} returns objects of class \code{phylog}. It creates the different representations compatible with tree topology.
}
\usage{
print.phylog(x, ...)
phylog.extract(phylog, node, distance = TRUE)
phylog.permut(phylog, list.nodes = NULL, distance = TRUE))
}
\arguments{
  \item{x, phylog}{: an object of class \code{phylog}}
  \item{\dots}{: further arguments passed to or from other methods}
  \item{node}{: a string of characters giving a node name. The functions extracts the tree rooted at this node.}
  \item{distance}{: if TRUE, both functions retain branch lengths. If FALSE, they returns tree with arbitrary branch lengths (each branch length equals one)}
  \item{list.nodes}{: a list which elements are vectors of string of character corresponding to direct descendants of nodes. This list defines one representation compatible with tree topology among the set of possibilities.}
}
\value{
Returns a list of class \code{phylog} :
    \item{tre}{: a character string of the phylogenetic tree in Newick format whithout branch length values}
    \item{leaves}{: a vector which names corresponds to leaves and values gives the distance between leaves and nodes closest to these leaves}
    \item{nodes}{: a vector which names corresponds to nodes and values gives the distance between nodes and nodes closest to these leaves}
    \item{parts}{: a list which elements gives the direct descendants of each nodes}
    \item{paths}{: a list which elements gives the path leading from the root to taxonomic units (leaves and nodes)}
    \item{droot}{: a vector which names corresponds to taxonomic units and values gives distance between taxonomic units and the root}
    \item{call}{: call} 
    \item{Wmat}{: a phylogenetic link matrix, generally called the covariance matrix. Matrix values \eqn{Wmat_{ij}}{Wmat_ij} correspond to path length that lead from root to the first common ancestor of the two leaves i and j}
    \item{Wdist}{: a phylogenetic distance matrix of class \code{'dist'}. Matrix values \eqn{Wdist_{ij}}{Wdist_ij} correspond to $\sqrt{d_{ij}}$ where \eqn{d_{ij}}{d_ij} is the classical distance between two leaves i and j}
    \item{Wvalues}{: a vector with the eigen values of Wmat}
    \item{Wscores}{: a data frame with eigen vectors of Wmat. This data frame defines an orthobasis that could be used to calculate the orthonormal decomposition of a biological trait on a tree.}
    \item{Amat}{: a phylogenetic link matrix stemed from Abouheif's test and defined in Ollier et al. (submited)}
    \item{Avalues}{: a vector with the eigen values of Amat}
    \item{Adim}{: number of positive eigen values}
    \item{Ascores}{: a data frame with eigen vectors of Amat. This data frame defines an orthobasis that could be used to calculate the orthonormal decomposition of a biological trait on a tree.}
    \item{Aparam}{: a data frame with attributes associated to nodes.}
    \item{Bindica}{: a data frame giving for some taxonomic units the partition of leaves that is associated to its}
    \item{Bscores}{: a data frame giving an orthobasis defined by Ollier et al. (submited) that could be used to calculate the orthonormal decomposition of a biological trait on a tree.}
    \item{Bvalues}{: a vector giving the degree of phylogenetic autocorrelation for each vectors of Bscores (Moran's form calculated with the matrix Wmat)}
    \item{Blabels}{: a vector giving for each nodes the name of the vector of Bscores that is associated to its}    
}
\references{
Ollier, S., Pontier, D. and Chessel, D. (submitted) Comments on Abouheif's test. \emph{Evolutionary Ecology Research}.

Ollier, S., Couteron, P. and Chessel, D. (submitted) Orthonormal transforms to detect and describe phylogenetic autocorrelation. \emph{Biometrics}.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{newick2phylog}}, \code{\link{plot.phylog}}}
\examples{
marthans.tre <- NULL
marthans.tre[1] <-"((((1:4,2:4)a:5,(3:7,4:7)b:2)c:2,5:11)d:2,"
marthans.tre[2] <- "((6:5,7:5)e:4,(8:4,9:4)f:5)g:4);"
marthans.phylog <- newick2phylog(marthans.tre)
marthans.phylog

if (require(ape, quietly=TRUE)) {
marthans.phylo <- read.tree(text = marthans.tre)
marthans.phylo

par(mfrow =c (1,2))
plot.phylog(marthans.phylog, cnode = 3, f = 0.8, cle = 3)
plot.phylo(marthans.phylo)
par(mfrow = c(1,1))
}
}
\keyword{manip}

\eof
\name{plot.phylog}
\alias{plot.phylog}
\alias{radial.phylog}
\alias{enum.phylog}
\title{Plot phylogenies}
\description{
\code{plot.phylog} draws phylogenetic trees as linear dendograms. \cr
\code{radial.phylog} draws phylogenetic trees as circular dendograms. \cr
\code{enum.phylog} enumerate all the possible representations for a phylogeny.
}
\usage{
plot.phylog(x, y = NULL, f.phylog = 0.5, cleaves = 1, cnodes = 0,
 labels.leaves = names(x$leaves), clabel.leaves = 1,
 labels.nodes = names(x$nodes), clabel.nodes = 0, sub = "",
 csub = 1.25, possub = "bottomleft", draw.box = FALSE, ...)
radial.phylog(phylog, circle = 1, cleaves = 1, cnodes = 0,
 labels.leaves = names(phylog$leaves), clabel.leaves = 1,
 labels.nodes = names(phylog$nodes), clabel.nodes = 0,
 draw.box = FALSE)
enum.phylog(phylog, no.over = 1000)
}
\arguments{
  \item{x, phylog}{an object of class \code{phylog}}
  \item{y}{a vector which values correspond to leaves positions}
  \item{f.phylog}{a size coefficient for tree size (a parameter to draw the tree in proportion to leaves label)}
  \item{circle}{a size coefficient for the outer circle}
  \item{cleaves}{a character size for plotting the points that represent the leaves, used with \code{par("cex")*cleaves}. If zero, no points are drawn}
  \item{cnodes}{a character size for plotting the points that represent the nodes, used with \code{par("cex")*cnodes}. If zero, no points are drawn}
  \item{labels.leaves}{a vector of strings of characters for the leaves labels}
  \item{clabel.leaves}{a character size for the leaves labels, used with \code{par("cex")*clabel.leaves}. If zero, no leaves labels are drawn}
  \item{labels.nodes}{a vector of strings of characters for the nodes labels}
  \item{clabel.nodes}{a character size for the nodes labels, used with \code{par("cex")*clabel.nodes}. If zero, no nodes labels are drawn}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{draw.box}{if TRUE draws a box around the current plot with the function \code{box()}}
  \item{\dots}{further arguments passed to or from other methods}
  \item{no.over}{a size coefficient for the number of representations}
}
\details{
The vector y is an argument of the function \code{plot.phylog} that ensures to plot one of the possible representations of a phylogeny.
The vector y is a permutation of the set of leaves \{1,2,\dots,f\} compatible with the phylogeny's topology.
}
\value{
The function \code{enum.phylog} returns a matrix with as many columns as leaves. Each row gives a permutation of the set of leaves \{1,2,\dots,f\} compatible with the phylogeny's topology. 
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{phylog}}}
\examples{
data(newick.eg)
par(mfrow = c(3,2))
for(i in 1:6) plot.phylog(newick2phylog(newick.eg[[i]], FALSE),
 clea = 2, clabel.l = 3, cnod = 2.5)
par(mfrow = c(1,1))

\dontrun{
par(mfrow = c(1,2))
plot.phylog(newick2phylog(newick.eg[[11]], FALSE), clea = 1.5,
 clabel.l = 1.5, clabel.nod = 0.75, f = 0.8)
plot.phylog(newick2phylog(newick.eg[[10]], FALSE), clabel.l = 0,
 clea = 0, cn = 0, f = 1)
par(mfrow = c(1,1))
}

par(mfrow = c(2,2))
w7 <- newick2phylog("(((((1,2,3)b),(6)c),(4,5)d,7)f);")
plot.phylog(w7,clabel.l = 1.5, clabel.n = 1.5, f = 0.8, cle = 2,
 cnod = 3, sub = "(((((1,2,3)b),(6)c),(4,5)d,7)f);", csub = 2)
w <- NULL
w[1] <- "((((e1:4,e2:4)a:5,(e3:7,e4:7)b:2)c:2,e5:11)d:2,"
w[2] <- "((e6:5,e7:5)e:4,(e8:4,e9:4)f:5)g:4);"
plot(newick2phylog(w), f = 0.8, cnod = 2, cleav = 2, clabel.l = 2)

data(taxo.eg)
w <- taxo2phylog(as.taxo(taxo.eg[[1]]))
plot(w, clabel.lea = 1.25, clabel.n = 1.25, sub = "Taxonomy",
 csub = 3, f = 0.8, possub = "topleft")

provi.tre <- "(((a,b,c,d,e)A,(f,g,h)B)C)D;"
provi.phy <- newick2phylog(provi.tre)
plot.phylog(provi.phy, clabel.l = 2, clabel.n = 2, f = 0.8)
par(mfrow = c(1,1))

\dontrun{
par(mfrow = c(3,3))
for (j in 1:6) radial.phylog(newick2phylog(newick.eg[[j]],
 FALSE), clabel.l = 2, cnodes = 2)
radial.phylog(newick2phylog(newick.eg[[7]],FALSE), clabel.l = 2)
radial.phylog(newick2phylog(newick.eg[[8]],FALSE), clabel.l = 0,
 circle = 1.8)
radial.phylog(newick2phylog(newick.eg[[9]],FALSE), clabel.l = 1,
 clabel.n = 1, cle = 0, cnode = 1)
par(mfrow = c(1,1))

data(bsetal97)
bsetal.phy = taxo2phylog(as.taxo(bsetal97$taxo[,1:3]), FALSE)
radial.phylog(bsetal.phy, cnod = 1, clea = 1, clabel.l = 0.75,
 draw.box = TRUE, cir = 1.1)
par(mfrow = c(1,1))
}

\dontrun{
# plot all the possible representations of a phylogenetic tree
a <- "((a,b)A,(c,d,(e,f)B)C)D;"
wa <- newick2phylog(a)
wx <- enum.phylog(wa)
dim(wx)

par(mfrow = c(6,8))
fun <- function(x) {
    w  <-NULL
    lapply(x, function(y) w<<-paste(w,as.character(y),sep=""))
    plot(wa, x, clabel.n = 1.25, f = 0.75, clabel.l = 2,
     box = FALSE, cle = 1.5, sub = w, csub = 2)
    invisible()}
apply(wx,1,fun)
par(mfrow = c(1,1))
}

}
\keyword{hplot}

\eof
\name{procella}
\alias{procella}
\docType{data}
\title{Phylogeny and quantitative traits of birds}
\description{
This data set describes the phylogeny of 19 birds as reported by Bried et al. (2002). It also gives 6 traits corresponding to these 19 species.
}
\usage{data(procella)}
\format{
\code{procella} is a list containing the 2 following objects:  
\describe{     
   \item{tre}{is a character string giving the phylogenetic tree in Newick format.} 
   \item{traits}{is a data frame with 19 species and 6 traits}    
}}
\details{
Variables of \code{procella$traits} are the following ones: \cr
site.fid: a numeric vector that describes the percentage of site fidelity\cr
mate.fid: a numeric vector that describes the percentage of mate fidelity\cr
mass: an integer vector that describes the adult body weight (g)\cr
ALE: a numeric vector that describes the adult life expectancy (years)\cr
BF: a numeric vector that describes the breeding frequencies\cr
col.size: an integer vector that describes the colony size (no nests monitored)
}
\references{
Bried, J., Pontier, D. and Jouventin, P. (2002) Mate fidelity in monogamus birds: a re-examination of the Procellariiformes. 
\emph{Animal Behaviour}, \bold{65}, 235--246.
}
\examples{
data(procella)
pro.phy <- newick2phylog(procella$tre)
plot(pro.phy,clabel.n = 1, clabel.l = 1)
wt <- procella$traits
wt$site.fid[is.na(wt$site.fid)] <- mean(wt$site.fid[!is.na(wt$site.fid)])
wt$site.fid <- asin(sqrt(wt$site.fid/100))
wt$ALE[is.na(wt$ALE)] <- mean(wt$ALE[!is.na(wt$ALE)])
wt$ALE <- sqrt(wt$ALE)
wt$BF[is.na(wt$BF)] <- mean(wt$BF[!is.na(wt$BF)])
wt$mass <- log(wt$mass)
wt <- wt[, -6]
table.phylog(scalewt(wt), pro.phy)
gearymoran(pro.phy$Amat,wt,9999)
}
\keyword{datasets}

\eof
\name{procuste}
\alias{procuste}
\alias{plot.procuste}
\alias{print.procuste}
\title{Simple Procruste Rotation between two sets of points}
\description{
performs a simple procruste rotation between two sets of points. 
}
\usage{
procuste(df1, df2, scale = TRUE, nf = 4, tol = 1e-07) 
plot.procuste (x, xax = 1, yax = 2, \dots)
print.procuste (x, \dots)
}
\arguments{
  \item{df1, df2}{two data frames with the same rows}
  \item{scale}{a logical value indicating whether a transformation by the Gower's scaling (1971) should be applied}
  \item{nf}{an integer indicating the number of kept axes}
  \item{tol}{a tolerance threshold to test whether the distance matrix is Euclidean : an eigenvalue is considered positive if it is larger than \code{-tol*lambda1} where \code{lambda1} is the largest eigenvalue.}
  \cr
  \item{x}{an objet of class \code{procuste}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns a list of 9 components of the class \code{procuste}
  \item{d}{a numeric vector of the singular values}
  \item{rank}{an integer indicating the rank of the crossed matrix}
  \item{nfact}{an integer indicating the number of kept axes}
  \item{tab1}{a data frame with the array 1, possibly scaled}
  \item{tab2}{a data frame with the array 2, possibly scaled}
  \item{rot1}{a data frame with the result of the rotation from array 1 to array 2}
  \item{rot2}{a data frame with the result of the rotation from array 2 to array 1}
  \item{load1}{a data frame with the loadings of array 1}
  \item{load2}{a data frame with the loadings of array 2}
  \item{scor1}{a data frame with the scores of array 1}
  \item{scor2}{a data frame with the scores of array 2}
  \item{call}{a call order of the analysis}
}
\references{
Digby, P. G. N. and Kempton, R. A. (1987) Multivariate Analysis of Ecological Communities. \emph{Population and Community Biology Series}, Chapman and Hall, London.\cr\cr
Gower, J.C. (1971) Statistical methods of comparing different multivariate analyses of the same data. In \emph{Mathematics in the archaeological and historical sciences}, Hodson, F.R, Kendall, D.G. & Tautu, P. (Eds.) University Press, Edinburgh,  138--149.\cr\cr
Schönemann, P.H. (1968) On two-sided Procustes problems. \emph{Psychometrika}, \bold{33}, 19--34.\cr\cr
Torre, F. and Chessel, D. (1994) Co-structure de deux tableaux totalement appariés. \emph{Revue de Statistique Appliquée}, \bold{43}, 109--121.\cr\cr
Dray, S., Chessel, D. and Thioulouse, J.  (2003) Procustean co-inertia analysis for the linking of multivariate datasets. \emph{Ecoscience}, \bold{10}, 1, 110-119.
}
\examples{
data(macaca)
par(mfrow = c(2,2))
pro1 <- procuste(macaca$xy1, macaca$xy2, scal = FALSE)
s.match(pro1$tab1, pro1$rot2, clab = 0.7)
s.match(pro1$tab2, pro1$rot1, clab = 0.7)
pro2 <- procuste(macaca$xy1, macaca$xy2)
s.match(pro2$tab1, pro2$rot2, clab = 0.7)
s.match(pro2$tab2, pro2$rot1, clab = 0.7)
par(mfrow = c(1,1))

data(doubs)
pca1 <- dudi.pca(doubs$mil, scal = TRUE, scann = FALSE)
pca2 <- dudi.pca(doubs$poi, scal = FALSE, scann = FALSE)
pro3 <- procuste(pca1$tab, pca2$tab, nf = 2)
par(mfrow = c(2,2))
s.traject(pro3$scor1, clab = 0)
s.label(pro3$scor1, clab = 0.8, add.p = TRUE)
s.traject(pro3$scor2, clab = 0)
s.label(pro3$scor2, clab = 0.8, add.p = TRUE)
s.arrow(pro3$load1, clab = 0.75)
s.arrow(pro3$load2, clab = 0.75)
plot(pro3)
par(mfrow = c(1,1))

data(fruits)
plot(procuste(scalewt(fruits$jug), scalewt(fruits$var)))
}
\keyword{multivariate}

\eof
\name{procuste.randtest}
\alias{procuste.randtest}
\title{
    Monte-Carlo Test on the sum of the singular values of a procustean rotation (in C).
}
\description{
performs a Monte-Carlo Test on the sum of the singular values of a procustean rotation. 
}
\usage{
procuste.randtest(df1, df2, nrepet = 999)
}
\arguments{
  \item{df1}{a data frame}
  \item{df2}{a data frame}
  \item{nrepet}{the number of permutations}
}
\value{
returns a list of class \code{randtest}
}
\references{
Jackson, D.A. (1995) PROTEST: a PROcustean randomization TEST of community environment concordance. \emph{Ecosciences}, \bold{2}, 297--303.
}
\examples{
data(doubs)
pca1 <- dudi.pca(doubs$mil, scal = TRUE, scann = FALSE)
pca2 <- dudi.pca(doubs$poi, scal = FALSE, scann = FALSE)
protest1 <- procuste.randtest(pca1$tab, pca2$tab, 999)
protest1
plot(protest1,main="PROTEST")
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{procuste.rtest}
\alias{procuste.rtest}
\title{
    Monte-Carlo Test on the sum of the singular values of a procustean rotation (in R).
}
\description{
performs a Monte-Carlo Test on the sum of the singular values of a procustean rotation. 
}
\usage{
procuste.rtest(df1, df2, nrepet = 99)
}
\arguments{
  \item{df1}{a data frame}
  \item{df2}{a data frame}
  \item{nrepet}{the number of permutations}
}
\value{
returns a list of class \code{rtest}
}
\references{
Jackson, D.A. (1995) PROTEST: a PROcustean randomization TEST of community environment concordance. \emph{Ecosciences}, \bold{2}, 297--303.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(doubs)
pca1 <- dudi.pca(doubs$mil, scal = TRUE, scann = FALSE)
pca2 <- dudi.pca(doubs$poi, scal = FALSE, scann = FALSE)
proc1 <- procuste(pca1$tab, pca2$tab)
protest1 <- procuste.rtest(pca1$tab, pca2$tab, 999)
protest1
plot(protest1)
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{pta}
\alias{pta}
\alias{print.pta}
\alias{plot.pta}
\title{Partial Triadic Analysis of a K-tables}
\description{
performs a partial triadic analysis of a K-tables, 
using an object of class \code{ktab}. 
}
\usage{
pta(X, scannf = TRUE, nf = 2)
plot.pta (x, xax = 1, yax = 2, option = 1:4, \dots)
print.pta (x, \dots)
}
\arguments{
  \item{X}{an object of class \code{ktab} where the arrays have 1) the same dimensions 2) the same names for columns 3) the same column weightings}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  
  \item{x}{an object of class 'pta'}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{option}{an integer between 1 and 4, otherwise the 4 components of the plot are displayed}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns a list of class 'pta', sub-class of  'dudi' containing :
  \item{RV}{a matrix with the all RV coefficients}
  \item{RV.eig}{a numeric vector with the all eigenvalues (interstructure)}
  \item{RV.coo}{a data frame with the scores of the arrays}
  \item{tab.names}{a vector of characters with the array names}
  \item{nf}{an integer indicating the number of kept axes}
  \item{rank}{an integer indicating the rank of the studied matrix}
  \item{tabw}{a numeric vector with the array weights}
  \item{cw}{a numeric vector with the column weights}
  \item{lw}{a numeric vector with the row weights}
  \item{eig}{a numeric vector with the all eigenvalues (compromis)}
  \item{cos2}{a numeric vector with the \eqn{\cos^2}{cos²} between compromise and arrays} 
  \item{tab}{a data frame with the modified array}
  \item{li}{a data frame with the row coordinates}
  \item{l1}{a data frame with the row normed scores}
  \item{co}{a data frame with the column coordinates}
  \item{c1}{a data frame with the column normed scores}
  \item{Tli}{a data frame with the row coordinates (each table)}
  \item{Tco}{a data frame with the column coordinates (each table)}
  \item{Tcomp}{a data frame with the principal components (each table)}
  \item{Tax}{a data frame with the principal axes (each table)}
  \item{TL}{a data frame with the factors for Tli}
  \item{TC}{a data frame with the factors for Tco}
  \item{T4}{a data frame with the factors for Tax and Tcomp}
}
\references{
Blanc, L., Chessel, D. and Dolédec, S. (1998) Etude de la stabilité temporelle des structures spatiales par Analyse d'une série de tableaux faunistiques totalement appariés. \emph{Bulletin Français de la Pêche et de la Pisciculture}, \bold{348}, 1--21.\cr\cr
Thioulouse, J., and D. Chessel. 1987. Les analyses multi-tableaux en écologie factorielle. I De la typologie d'état à la typologie de fonctionnement par l'analyse triadique. \emph{Acta Oecologica, Oecologia Generalis}, \bold{8}, 463--480.
}
\author{P. Bady}
\examples{
data(meaudret)
wit1 <- within.pca(meaudret$mil, meaudret$plan$dat, scan = FALSE, 
    scal = "partial")
kta1 <- ktab.within(wit1, colnames = rep(c("S1","S2","S3","S4","S5"), 4))
kta2 <- t(kta1)
pta1 <- pta(kta2, scann = FALSE)
pta1
plot(pta1)
}
\keyword{multivariate}

\eof
\name{quasieuclid}
\alias{quasieuclid}
\title{Transformation of a distance matrice to a Euclidean one}
\description{
transforms a distance matrix in a Euclidean one. 
}
\usage{
quasieuclid(distmat)
}
\arguments{
  \item{distmat}{an object of class \code{dist}}
}
\details{
 The function creates a distance matrice with the positive eigenvalues of the Euclidean representation. \cr 
 Only for Euclidean distances which are not Euclidean for numeric approximations (for examples, in papers as the following example).
}
\value{
object of class \code{dist} containing a Euclidean distance matrice
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(yanomama)
geo <- as.dist(yanomama$geo)
is.euclid(geo) # FALSE
geo1 <- quasieuclid(geo)
is.euclid(geo1) # TRUE
par(mfrow = c(2,2))
lapply(yanomama, function(x) plot(as.dist(x), quasieuclid(as.dist(x))))

par(mfrow = c(1,1))}
\keyword{array}

\eof
\name{randtest-internal}
\alias{testdiscrimin}
\alias{testertrace}
\alias{testertracenu}
\alias{testertracenubis}
\alias{testinter}
\alias{testprocuste}
\alias{testmantel}
\alias{testertracerlq}
\alias{testamova}
\title{Internal Permutation Tests functions (in C).}
\description{
Internal Permutation Tests functions (in C)
}
\usage{
}
\details{
These are not to be called by the user.
}
\keyword{ internal }

\eof
\name{randtest}
\alias{randtest}
\alias{as.randtest}
\alias{plot.randtest}
\alias{print.randtest}
\title{Class of the Permutation Tests (in C).}
\description{
randtest is a generic function. It proposes methods for the following objects \code{between}, \code{discrimin}, \code{coinertia} \code{\dots}\cr
}
\usage{
    randtest(xtest, \dots)
    plot.randtest(x, nclass = 10, coeff = 1, \dots)
    as.randtest (sim, obs, call = match.call())
    print.randtest (x, \dots)
}
\arguments{
\item{xtest}{an object used to select a method}
\item{x}{an object of class \code{randtest}}
\item{\dots}{\code{\dots} further arguments passed to or from other methods; in \code{plot.randtest} to \code{hist}}
\item{nclass}{a number of intervals for the histogram}
\item{coeff}{to fit the magnitude of the graph}
\item{sim}{a numeric vector of simulated values}
\item{obs}{a numeric vector of an observed value}
\item{call}{a call order}
}
\value{
\code{as.randtest} returns a list of class \code{randtest}\cr
\code{plot.randtest} draws the simulated values histograms and the position of the observed value\cr
}
\seealso{\link{mantel.randtest}, \link{procuste.randtest}, \link{rtest}}
\examples{
par(mfrow = c(2,2))
for (x0 in c(2.4,3.4,5.4,20.4)) {
    l0 <- as.randtest(sim = rnorm(200), obs = x0)
    print(l0)
    plot(l0,main=paste("p.value = ", round(l0$pvalue, dig = 5)))
}
par(mfrow = c(1,1))
}
\keyword{methods}

\eof
\name{randtest.amova}
\alias{randtest.amova}
\title{
Permutation tests on an analysis of molecular variance (in C).}
\description{
Tests the components of covariance with permutation processes described by Excoffier et al. (1992).
}
\usage{
randtest.amova(xtest, nrepet = 99, \dots)
}
\arguments{
  \item{xtest}{an object of class \code{amova}}
  \item{nrepet}{the number of permutations}
  \item{\dots}{\code{\dots} further arguments passed to or from other methods}
}
\value{
returns an object of class \code{krandtest} or \code{randtest}
}
\references{
  Excoffier, L., Smouse, P.E. and Quattro, J.M. (1992) Analysis of molecular variance inferred from
  metric distances among DNA haplotypes: application to human mitochondrial DNA restriction data.
  \emph{Genetics}, \bold{131}, 479--491.
}
\author{Sandrine Pavoine \email{pavoine@biomserv.univ-lyon1.fr}
}
\examples{
data(humDNAm)
amovahum <- amova(humDNAm$samples, sqrt(humDNAm$distances), humDNAm$structures)
amovahum
randtesthum <- randtest.amova(amovahum, 49)
plot(randtesthum)
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{randtest.between}
\alias{randtest.between}
\title{Monte-Carlo Test on the between-groups inertia percentage (in C).
}
\description{
Performs a Monte-Carlo test on the between-groups inertia percentage. 
}
\usage{
randtest.between(xtest, nrepet = 999, \dots)
}
\arguments{
  \item{xtest}{an object of class \code{between}}
  \item{nrepet}{the number of permutations}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
a list of the class \code{randtest}
}
\references{
Romesburg, H. C. (1985) Exploring, confirming and randomization tests. \emph{Computers and Geosciences}, \bold{11}, 19--37.
}
\examples{
data(meaudret)
pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 3)
rand1 <- randtest(between(pca1, meaudret$plan$dat, scan = FALSE), 99)
rand1
plot(rand1, main = "Monte-Carlo test")
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{randtest.coinertia}
\alias{randtest.coinertia}
\title{Monte-Carlo test on a coinertia analysis (in C).}
\description{
Performs a Monte-Carlo test on a coinertia analysis. 
}
\usage{
randtest.coinertia(xtest, nrepet = 999, fixed=0, \dots)
}
\arguments{
  \item{xtest}{an object of class \code{coinertia}}
  \item{nrepet}{the number of permutations}
  \item{fixed}{when non uniform row weights are used in the coinertia analysis,
this parameter must be the number of the table that should be kept fixed in the permutations}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
a list of the class \code{randtest}
}
\references{
Doledec, S. and Chessel, D. (1994) Co-inertia analysis: an alternative method for
studying species-environment relationships. \emph{Freshwater Biology}, \bold{31}, 277--294.
}
\examples{
data(doubs)
dudi1 <- dudi.pca(doubs$mil, scale = TRUE, scan = FALSE, nf = 3)
dudi2 <- dudi.pca(doubs$poi, scale = FALSE, scan = FALSE, nf = 2)
coin1 <- coinertia(dudi1,dudi2, scan = FALSE, nf = 2)
plot(randtest(coin1))
 }
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{randtest.discrimin}
\alias{randtest.discrimin}
\title{
Monte-Carlo Test on a Discriminant Analysis (in C).}
\description{
Test of the sum of a discriminant analysis eigenvalues (divided by the rank). Non parametric version of the Pillai's test. It authorizes any weighting.
}
\usage{
randtest.discrimin(xtest, nrepet = 999, \dots)
}
\arguments{
  \item{xtest}{an object of class \code{discrimin}}
  \item{nrepet}{the number of permutations}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns a list of class \code{randtest}
}
\examples{
data(meaudret)
pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 3)
rand1 <- randtest(discrimin(pca1, meaudret$plan$dat, scan = FALSE), 99)
rand1
#Monte-Carlo test
#Observation: 0.3035 
#Call: as.randtest(sim = sim, obs = obs)
#Based on 999 replicates
#Simulated p-value: 0.001 
plot(rand1, main = "Monte-Carlo test")
summary.manova(manova(as.matrix(meaudret$mil)~meaudret$plan$dat), "Pillai")
#                   Df Pillai approx F num Df den Df  Pr(>F)    
# meaudret$plan$dat  3   2.73    11.30     27     30 1.6e-09 ***
# Residuals         16                                          
# ---
# Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 
# 2.731/9 = 0.3034
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{rankrock}
\alias{rankrock}
\docType{data}
\title{Ordination Table}
\description{
This data set gives the classification in order of preference of 10 music groups by 51 students. 
}
\usage{data(rankrock)}
\format{
A data frame with 10 rows and 51 columns.\cr
Each column contains the rank (1 for the favorite, \dots, 10 for the less appreciated)\cr
attributed to the group by a student.
}
\examples{
data(rankrock)
dudi1 <- dudi.pca(rankrock, scannf = FALSE, nf = 3)
scatter(dudi1, clab.r = 1.5)
}
\keyword{datasets}

\eof
\name{reconst}
\alias{reconst}
\alias{reconst.pca}
\title{Reconstitution of Data from a Duality Diagram}
\description{
Generic Function. Nowadays just \code{reconst.pca}
}
\usage{
reconst (dudi, ...)
reconst.pca (dudi, nf = 1, ...) 
}
\arguments{
  \item{dudi}{an object used to select a method}
  \item{\dots}{\code{\dots} further arguments passed to or from other methods}
  
  \item{nf}{an integer indicating the number of kept axes}
}
\value{
a data frame reconstituting the data
}
\references{Gabriel, K.R. (1978) Least-squares approximation of matrices by additive and multiplicative models. \emph{Journal of the Royal Statistical Society}, B , \bold{40}, 186--196.
}
\examples{
data(rhone)
dd1 <- dudi.pca(rhone$tab, nf = 2, scann = FALSE)
rh1 <- reconst(dd1, 1)
rh2 <- reconst(dd1, 2)
par(mfrow = c(4,4))
par(mar = c(2.6,2.6,1.1,1.1))
for (i in 1:15) {
    plot(rhone$date, rhone$tab[,i])
    lines(rhone$date, rh1[,i], lty = 2)
    lines(rhone$date, rh2[,i], lty = 1)
    scatterutil.sub(names(rhone$tab)[i], 2, "topright")
}
}
\keyword{multivariate}

\eof
\name{rhone}
\alias{rhone}
\docType{data}
\title{Physico-Chemistry Data}
\description{
This data set gives for 39 water samples a physico-chemical description 
with the number of sample date and the flows of three tributaries. 
}
\usage{data(rhone)}
\format{
    \code{rhone} is a list of 3 components.
\describe{
    \item{tab}{is a data frame with 39 water samples and 15 physico-chemical variables.}
    \item{date}{is a vector of the sample date (in days).}
    \item{disch}{is a data frame with 39 water samples and the flows of the three tributaries.}
    }
}
\source{
Carrel, G., Barthelemy, D., Auda, Y. and Chessel, D. (1986)
Approche graphique de l'analyse en composantes principales normée : utilisation en hydrobiologie.
\emph{Acta Oecologica, Oecologia Generalis}, \bold{7}, 189--203.
}
\examples{
data(rhone)
pca1 <- dudi.pca(rhone$tab, nf = 2, scann = FALSE)
rh1 <- reconst(pca1, 1)
rh2 <- reconst(pca1, 2)
par(mfrow = c(4,4))
par(mar = c(2.6,2.6,1.1,1.1))
for (i in 1:15) {
    plot(rhone$date, rhone$tab[,i])
    lines(rhone$date, rh1[,i], lwd = 2)
    lines(rhone$date, rh2[,i])
    scatterutil.sub(names(rhone$tab)[i], 2, "topright")
}
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{rlq}
\alias{rlq}
\alias{print.rlq}
\alias{plot.rlq}
\alias{summary.rlq}
\alias{as.coinertia}
\alias{randtest.rlq}
\title{RLQ analysis }
\description{
RLQ analysis performs a double inertia analysis of two arrays (R and Q) with a link expressed by a contingency table (L).
The rows of L correspond to the rows of R and the columns of Q correspond to the rows of Q.
RLQ analysis is an extension of coinertia analysis (see as.coinertia function).
}
\usage{
rlq(dudiR, dudiL, dudiQ, scannf = TRUE, nf = 2)
print.rlq(x, ...)
plot.rlq(x, xax = 1, yax = 2, ...)
summary.rlq(object, ...)
as.coinertia (dudiRLQ, fixed="R")
randtest.rlq(xtest,nrepet = 999, RV = TRUE, ...)
}

\arguments{
  \item{dudiR}{ a duality diagram providing from one of the functions dudi.hillsmith, dudi.pca, \dots }
  \item{dudiL}{ a duality diagram of the function dudi.coa }
  \item{dudiQ}{ a duality diagram providing from one of the functions dudi.hillsmith, dudi.pca, \dots }
  \item{scannf}{ a logical value indicating whether the eigenvalues bar plot should be displayed }
  \item{nf}{ if scannf FALSE, an integer indicating the number of kept axes }
  \item{x}{ an rlq object }
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{dudiRLQ}{ an rlq object }
  \item{object}{ an rlq object }
  \item{fixed}{ "R" indicates that dudiR is not modified, otherwise "Q" }
  \item{RV}{ a logical value indicating whether the test is based on RV or inertia }
  \item{xtest}{ an rlq object }
  \item{nrepet}{ the number of permutations }
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
  Returns a list of class 'dudi', sub-class 'rlq' containing:
  \item{call}{call}
  \item{rank}{rank}
  \item{nf}{a numeric value indicating the number of kept axes}
  \item{RV}{a numeric value, the RV coefficient}
  \item{eig}{a numeric vector with all the eigenvalues}
  \item{lw}{a numeric vector with the rows weigths (crossed array)}
  \item{cw}{a numeric vector with the columns weigths (crossed array)}
  \item{tab}{a crossed array (CA)} 
  \item{li}{R col = CA row: coordinates}
  \item{l1}{R col = CA row: normed scores}
  \item{co}{Q col = CA column: coordinates}
  \item{c1}{Q col = CA column: normed scores}
  \item{lR}{the row coordinates (R)}
  \item{mR}{the normed row scores (R)}
  \item{lQ}{the row coordinates (Q)}
  \item{mQ}{the normed row scores (Q)}
  \item{aR}{the axis onto co-inertia axis (R)}
  \item{aQ}{the axis onto co-inertia axis (Q)}
}
\references{ 
Doledec, S., Chessel, D., ter Braak, C.J.F. and Champely, S. (1996) 
Matching species traits to environmental variables: a new three-table ordination method. \emph{Environmental and Ecological Statistics}, 
\bold{3}, 143--166.

Dray, S., Pettorelli, N., Chessel, D. (2002) Matching data sets from two different spatial samplings. 
\emph{Journal of Vegetation Science}, \bold{13}, 867--874.
}
\author{ Stephane Dray \email{dray@biomserv.univ-lyon1.fr}}

\section{WARNING }{
IMPORTANT : row weights for \code{dudiR} and \code{dudiQ} must be taken from \code{dudiL}.
}
\note{\code{as.coinertia} transforms a \code{rlq} object into a \code{coinertia} object but user must specify which \code{dudi} is fixed and not modified.} 
\seealso{ \code{\link{coinertia}} }
\examples{
data(aviurba)
   coa1 <- dudi.coa(aviurba$fau, scannf = FALSE, nf = 2)
   dudimil <- dudi.hillsmith(aviurba$mil, scannf = FALSE, nf = 2, row.w = coa1$lw)
   duditrait <- dudi.hillsmith(aviurba$traits, scannf = FALSE, nf = 2, row.w = coa1$cw)
   rlq1 <- rlq(dudimil, coa1, duditrait, scannf = FALSE, nf = 2)
   plot(rlq1)
   summary(rlq1)
   randtest.rlq(rlq1)
}
\keyword{ multivariate }
\keyword{ spatial }

\eof
\name{rpjdl}
\alias{rpjdl}
\docType{data}
\title{Avifauna and Vegetation}
\description{
This data set gives the abundance of 52 species and 8 environmental variables 
in 182 sites. 
}
\usage{data(rpjdl)}
\format{
    \code{rpjdl} is a list of 5 components.
    \describe{
    \item{fau}{is the faunistic array of 182 sites (rows) and 52 species (columns).}
    \item{mil}{is the array of environmental variables : 182 sites and 8 variables.}
    \item{frlab}{is a vector of the names of species in French.}
    \item{lalab}{is a vector of the names of species in Latin.}
    \item{lab}{is a vector of the simplified labels of species.}
    }
}
\source{
Prodon, R. and Lebreton, J.D. (1981)
Breeding avifauna of a Mediterranean succession : the holm oak and cork oak series in the eastern Pyrénées.
1 : Analysis and modelling of the structure gradient.
\emph{Oïkos}, \bold{37}, 21--38.

Lebreton, J. D., Chessel D., Prodon R. and Yoccoz N. (1988)
L'analyse des relations espèces-milieu par l'analyse canonique des correspondances.
I. Variables de milieu quantitatives.
\emph{Acta Oecologica, Oecologia Generalis}, \bold{9}, 53--67.
}
\examples{
\dontrun{
data(rpjdl)
xy <- dudi.coa(rpjdl$fau, scann = FALSE)$l1
s.distri(xy, rpjdl$fau, 2, 1, cstar = 0.3, cell = 0)

xy1 <- dudi.pca(rpjdl$fau, scal = FALSE, scann = FALSE)$l1
s.distri(xy1, rpjdl$fau, 2, 1, cstar = 0.3, cell = 0)

cca1 <- cca(rpjdl$fau, rpjdl$mil, scan = FALSE)
plot(cca1)

}}
\keyword{datasets}

\eof
\name{rtest}
\alias{rtest}
\alias{as.rtest}
\alias{plot.rtest}
\alias{print.rtest}
\title{Class of the Permutation Tests (in R).}
\description{
rtest is a generic function. It proposes methods for the following objects \code{between}, \code{discrimin}, \code{procuste} \code{\dots}\cr
}
\usage{
    rtest(xtest, \dots)
    plot.rtest(x, nclass = 10, coeff = 1, \dots)
    as.rtest (sim, obs, call = match.call())
    print.rtest (x, \dots)
}
\arguments{
\item{xtest}{an object used to select a method}
\item{x}{an object of class 'rtest'}
\item{\dots}{further arguments passed to or from other methods; in \code{plot.randtest} to \code{hist}}
\item{nclass}{a number of intervals for the histogram}
\item{coeff}{to fit the magnitude of the graph}
\item{sim}{a numeric vector of simulated values}
\item{obs}{a numeric vector of an observed value}
\item{call}{a call order}
}
\value{
\code{as.rtest} returns a list of class \code{rtest}\cr
\code{plot.rtest} draws the simulated values histograms and the position of the observed value\cr
}
\seealso{\code{\link{RV.rtest}}, \code{\link{mantel.rtest}}, \code{\link{procuste.rtest}}, \code{\link{randtest}}}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
par(mfrow = c(2,2))
for (x0 in c(2.4,3.4,5.4,20.4)) {
    l0 <- as.rtest(sim = rnorm(200), obs = x0)
    print(l0)
    plot(l0,main=paste("p.value = ", round(l0$pvalue, dig = 5)))
}
}
\keyword{methods}

\eof
\name{rtest.between}
\alias{rtest.between}
\title{Monte-Carlo Test on the between-groups inertia percentage (in R).
}
\description{
Performs a Monte-Carlo test on the between-groups inertia percentage. 
}
\usage{
rtest.between(xtest, nrepet = 99, \dots)
}
\arguments{
  \item{xtest}{an object of class \code{between}}
  \item{nrepet}{the number of permutations}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
a list of the class \code{rtest}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\references{
Romesburg, H. C. (1985) Exploring, confirming and randomization tests. \emph{Computers and Geosciences}, \bold{11}, 19--37.
}
\examples{
data(meaudret)
pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 3)
rand1 <- rtest(between(pca1, meaudret$plan$dat, scan = FALSE), 99)
rand1
plot(rand1, main = "Monte-Carlo test")
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{rtest.discrimin}
\alias{rtest.discrimin}
\title{
Monte-Carlo Test on a Discriminant Analysis (in R).
}
\description{
Test of the sum of a discriminant analysis eigenvalues (divided by the rank). Non parametric version of the Pillai's test. It authorizes any weighting.
}
\usage{
rtest.discrimin(xtest, nrepet = 99, \dots)
}
\arguments{
  \item{xtest}{an object of class \code{discrimin}}
  \item{nrepet}{the number of permutations}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns a list of class \code{rtest}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(meaudret)
pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 3)
rand1 <- rtest(discrimin(pca1, meaudret$plan$dat, scan = FALSE), 99)
rand1
#Monte-Carlo test
#Observation: 0.3035 
#Call: as.rtest(sim = sim, obs = obs)
#Based on 999 replicates
#Simulated p-value: 0.001 
plot(rand1, main = "Monte-Carlo test")
summary.manova(manova(as.matrix(meaudret$mil)~meaudret$plan$dat), "Pillai")
#                   Df Pillai approx F num Df den Df  Pr(>F)    
# meaudret$plan$dat  3   2.73    11.30     27     30 1.6e-09 ***
# Residuals         16                                          
# ---
# Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 
# 2.731/9 = 0.3034
}
\keyword{multivariate}
\keyword{nonparametric}

\eof
\name{s.arrow}
\alias{s.arrow}
\title{Plot of the factorial maps for the projection of a vector basis}
\description{
performs the scatter diagrams of the projection of a vector basis. 
}
\usage{
s.arrow(dfxy, xax = 1, yax = 2, label = row.names(dfxy), 
    clabel = 1, pch = 20, cpoint = 0, edge = TRUE, origin = c(0,0), 
    xlim = NULL, ylim = NULL, grid = TRUE, addaxes = TRUE, cgrid = 1, 
    sub = "", csub = 1.25, possub = "bottomleft", pixmap = NULL, 
    contour = NULL, area = NULL, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame containing the two columns for the axes}
  \item{xax}{the column number of x in \code{dfxy}}
  \item{yax}{the column number of y in \code{dfxy}}
  \item{label}{a vector of strings of characters for the point labels}
  \item{clabel}{if not NULL, a character size for the labels used with par("cex")*\code{clabel}}
  \item{pch}{if \code{cpoint} > 0, an integer specifying the symbol or the single character to be used in plotting points}
  \item{cpoint}{a character size for plotting the points, used with par("cex")*\code{cpoint}. If zero, no points are drawn.}
  \item{edge}{a logical value indicating whether the arrows should be plotted}
  \item{origin}{the fixed point in the graph space, by default c(0,0) the origin of axes. The arrows begin at \code{cent}.}
  \item{xlim}{the ranges to be encompassed by the x-axis, if NULL they are computed}
  \item{ylim}{the ranges to be encompassed by the y-axis, if NULL they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{cgrid}{a character size, parameter used with par("cex")*\code{cgrid}, to indicate the mesh of the grid}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the legend position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{pixmap}{an object 'pixmap' displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
s.arrow(cbind.data.frame(runif(55,-2,3), runif(55,-3,2)))
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.chull}
\alias{s.chull}
\title{Plot of the factorial maps with polygons of contour by level of a factor}
\description{
performs the scatter diagrams with polygons of contour by level of a factor. 
}
\usage{
s.chull(dfxy, fac, xax = 1, yax = 2, 
    optchull = c(0.25, 0.5, 0.75, 1), label = levels(fac), clabel = 1, 
    cpoint = 0, col = rep(1, length(levels(fac))), xlim = NULL, ylim = NULL,
    grid = TRUE, addaxes = TRUE, origin = c(0,0), include.origin = TRUE, 
    sub = "", csub = 1, possub = "bottomleft", cgrid = 1, pixmap = NULL, 
    contour = NULL, area = NULL, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame containing the two columns for the axes}
  \item{fac}{a factor partioning the rows of the data frame in classes}
  \item{xax}{the column number of x in \code{dfxy}}
  \item{yax}{the column number of y in \code{dfxy}}
  \item{optchull}{the number of convex hulls and their interval}
  \item{label}{a vector of strings of characters for the point labels}
  \item{clabel}{if not NULL, a character size for the labels, used with  \code{par("cex")*clabel}}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn}
  \item{col}{a vector of colors used to draw each class in a different color}
  \item{xlim}{the ranges to be encompassed by the x axis, if NULL, they are computed}
  \item{ylim}{the ranges to be encompassed by the y axis, if NULL they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{cgrid}{a character size, parameter used with par("cex")* \code{cgrid} to indicate the mesh of the grid}
  \item{pixmap}{an object 'pixmap' displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
xy <- cbind.data.frame(x = runif(200,-1,1), y = runif(200,-1,1))
posi <- factor(xy$x > 0) : factor(xy$y > 0)
coul <- c("black", "red", "green", "blue")
s.chull(xy, posi, cpoi = 1.5, col = coul)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.class}
\alias{s.class}
\title{Plot of factorial maps with representation of point classes}
\description{
performs the scatter diagrams with representation of point classes. 
}
\usage{
s.class(dfxy, fac, wt = rep(1, length(fac)), xax = 1, 
    yax = 2, cstar = 1, cellipse = 1.5, axesell = TRUE, 
    label = levels(fac), clabel = 1, cpoint = 1, pch = 20, 
    col = rep(1, length(levels(fac))), xlim = NULL, ylim = NULL, 
    grid = TRUE, addaxes = TRUE, origin = c(0,0), 
    include.origin = TRUE, sub = "", csub = 1, possub = "bottomleft", 
    cgrid = 1, pixmap = NULL, contour = NULL, area = NULL, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame containing the two columns for the axes}
  \item{fac}{a factor partitioning the rows of the data frame in classes}
  \item{wt}{a vector of the point weightings of the data frame used for computing the means (star centers) and the ellipses of dispersion}
  \item{xax}{the column number of x in \code{dfxy}}
  \item{yax}{the column number of y in \code{dfxy}}
  \item{cstar}{a number between 0 and 1 which defines the length of the star size}
  \item{cellipse}{a positive coefficient for the inertia ellipse size}
  \item{axesell}{a logical value indicating whether the ellipse axes should be drawn}
  \item{label}{a vector of strings of characters for the point labels}
  \item{clabel}{if not NULL, a character size for the labels, used with \code{par("cex")*clabel}}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn}
  \item{pch}{if \code{cpoint} > 0, an integer specifying the symbol or the single character to be used in plotting points}
  \item{col}{a vector of colors used to draw each class in a different color}
  \item{xlim}{the ranges to be encompassed by the x, if NULL they are computed}
  \item{ylim}{the ranges to be encompassed by the y, if NULL they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{cgrid}{a character size, parameter used with par("cex")* \code{cgrid} to indicate the mesh of the grid}
  \item{pixmap}{an object 'pixmap' displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
xy <- cbind.data.frame(x = runif(200,-1,1), y = runif(200,-1,1))
posi <- factor(xy$x > 0) : factor(xy$y > 0)
coul <- c("black", "red", "green", "blue")
par(mfrow = c(2,2))
s.class(xy, posi, cpoi = 2)
s.class(xy, posi, cell = 0, cstar = 0.5)
s.class(xy, posi, cell = 2, axesell = FALSE, csta = 0, col = coul)
s.chull(xy, posi, cpoi = 1)
par(mfrow = c(1,1))

\dontrun{
data(banque)
dudi1 <- dudi.acm(banque, scannf = FALSE)
coul = rainbow(length(levels(banque[,20])))
par(mfrow = c(2,2))
s.label(dudi1$li, sub = "Factorial map from ACM", csub = 1.5, 
    possub = "topleft")
s.class(dudi1$li, banque[,20], sub = names(banque)[20], 
    possub = "bottomright", cell = 0, cstar = 0.5, cgrid = 0, csub = 1.5)
s.class(dudi1$li, banque[,20], csta = 0, cell = 2, cgrid = 0, 
    clab = 1.5)
s.class(dudi1$li, banque[,20], sub = names(banque)[20], 
    possub = "topright", cgrid = 0, col = coul)
par(mfrow = c(1,1))

par(mfrow = n2mfrow(ncol(banque)))
for (i in 1:(ncol(banque)))
    s.class(dudi1$li, banque[,i], clab = 1.5, sub = names(banque)[i], 
    csub = 2, possub = "topleft", cgrid = 0, csta = 0, cpoi = 0)
s.label(dudi1$li, clab = 0, sub = "Common background")
par(mfrow = c(1,1))
}}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.corcircle}
\alias{s.corcircle}
\title{Plot of the factorial maps of a correlation circle}
\description{
performs the scatter diagram of a correlation circle. 
}
\usage{
s.corcircle(dfxy, xax = 1, yax = 2, label = row.names(df), 
    clabel = 1, grid = TRUE, sub = "", csub = 1, possub = "bottomleft", 
    cgrid = 0, fullcircle = TRUE, box = FALSE, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame with two coordinates }
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{label}{a vector of strings of characters for the point labels}
  \item{clabel}{if not NULL, a character size for the labels, used with  \code{par("cex")*clabel}}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{cgrid}{a character size, parameter used with par("cex")*\code{cgrid} to indicate the mesh of the grid}
  \item{fullcircle}{a logical value indicating whether the complete circle sould be drawn}
  \item{box}{a logical value indcating whether a box should be drawn}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data (olympic)
dudi1 <- dudi.pca(olympic$tab, scan = FALSE) # a normed PCA
par(mfrow = c(2,2))
s.corcircle(dudi1$co, lab = names(olympic$tab))
s.corcircle(dudi1$co, cgrid = 0, full = FALSE, clab = 0.8)
s.corcircle(dudi1$co, lab = as.character(1:11), cgrid = 2, 
    full = FALSE, sub = "Correlation circle", csub = 2.5, 
    possub = "bottomleft", box = TRUE)
s.arrow(dudi1$co, clab = 1)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.distri}
\alias{s.distri}
\title{Plot of a frequency distribution}
\description{
performs the scatter diagram of a frequency distribution. 
}
\usage{
s.distri(dfxy, dfdistri, xax = 1, yax = 2, cstar = 1, 
    cellipse = 1.5, axesell = TRUE, label = names(dfdistri), 
    clabel = 0, cpoint = 1, pch = 20, xlim = NULL, ylim = NULL, 
    grid = TRUE, addaxes = TRUE, origin = c(0,0), 
    include.origin = TRUE, sub = "", csub = 1, possub = "bottomleft", 
    cgrid = 1, pixmap = NULL, contour = NULL, area = NULL, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame containing two columns for the axes}
  \item{dfdistri}{a data frame containing the mass distributions in columns}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{cstar}{a number between 0 and 1 which defines the length of the star size}
  \item{cellipse}{a positive coefficient for the inertia ellipse size}
  \item{axesell}{a logical value indicating whether the ellipse axes should be drawn}
  \item{label}{a vector of strings of characters for the distribution centers labels}
  \item{clabel}{if not NULL, a character size for the labels, used with \code{par("cex")*clabel}}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn}
  \item{pch}{if \code{cpoint} > 0, an integer specifying the symbol or the single character to be used in plotting points}
  \item{xlim}{the ranges to be encompassed by the x, if NULL they are computed}
  \item{ylim}{the ranges to be encompassed by the y, if NULL they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{cgrid}{a character size, parameter used with par("cex")* \code{cgrid} to indicate the mesh of the grid}
  \item{pixmap}{an object 'pixmap' displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
xy <- cbind.data.frame(x = runif(200,-1,1), y = runif(200,-1,1))
distri <- data.frame(w1 = rpois(200, xy$x * (xy$x > 0)))
s.value(xy, distri$w1, cpoi = 1)
s.distri(xy, distri, add.p = TRUE)

w1 <- as.numeric((xy$x> 0) & (xy$y > 0))
w2 <- ((xy$x > 0) & (xy$y < 0)) * (1 - xy$y) * xy$x
w3 <- ((xy$x < 0) & (xy$y > 0)) * (1 - xy$x) * xy$y
w4 <- ((xy$x < 0) & (xy$y < 0)) * xy$y * xy$x

distri <- data.frame(a = w1 / sum(w1), b = w2 / sum(w2), 
    c = w3 / sum(w3), d = w4 / sum(w4))
s.value(xy, unlist(apply(distri, 1, sum)), cleg = 0, csi = 0.75)
s.distri(xy, distri, clab = 2, add.p = TRUE)

data(rpjdl)
xy <- dudi.coa(rpjdl$fau, scan = FALSE)$li
par(mfrow = c(3,4))
for (i in c(1,5,8,20,21,23,26,33,36,44,47,49)){
s.distri(xy, rpjdl$fau[,i], cell = 1.5, sub = rpjdl$frlab[i], 
    csub = 2, cgrid = 1.5)}
par(mfrow = c(1,1))
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.hist}
\alias{s.hist}
\title{Display of a scatterplot and its two marginal histograms}
\description{
  performs a scatterplot and the two marginal histograms of each axis.
}
\usage{
s.hist(dfxy, xax = 1, yax = 2, cgrid = 1, cbreaks = 2, adjust = 1, ...)
}
\arguments{
  \item{dfxy}{a data frame with two coordinates }
  \item{xax}{column for the x axis }
  \item{yax}{column for the y axis }
  \item{cgrid}{a character size, parameter used with \code{par("cex")*cgrid} to indicate the mesh of the grid }
  \item{cbreaks}{a parameter used to define the numbers of cells for the histograms. By default,
  two cells are defined for each interval of the grid displayed in \code{s.label}. With an increase of the integer \code{cbreaks}, 
  the number of cells increases as well.}
  \item{adjust}{a parameter passed to \code{density} to display a kernel density estimation}
  \item{\dots}{further arguments passed from the \code{s.label} for the scatter plot}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(rpjdl)
coa1 <- dudi.coa(rpjdl$fau, scannf = FALSE, nf = 4)
s.hist(coa1$li)
s.hist(coa1$li, cgrid = 2, cbr = 3, adj = 0.5, clab = 0)
s.hist(coa1$co, cgrid = 2, cbr = 3, adj = 0.5, clab = 0)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.image}
\alias{s.image}
\title{ Graph of a variable using image and contour }
\description{
  performs a scatterplot
}
\usage{
s.image(dfxy, z, xax = 1, yax = 2, span = 0.5, xlim = NULL, ylim = NULL, 
  kgrid = 2, scale = TRUE, grid = FALSE, addaxes = FALSE, cgrid = 0, 
  include.origin = FALSE, origin = c(0, 0), sub = "", csub = 1, 
  possub = "topleft", neig = NULL, cneig = 1, image.plot = TRUE, 
  contour.plot = TRUE, pixmap = NULL, contour = NULL, area = NULL, 
  add.plot = FALSE)
}
\arguments{
  \item{dfxy}{ a data frame containing the two columns for the axes }
  \item{z}{ a vector of values on the \code{dfxy} rows }
  \item{xax}{ the column number of x in \code{dfxy} }
  \item{yax}{ the column number of y in \code{dfxy} }
  \item{span}{ the parameter alpha which controls the degree of smoothing }
  \item{xlim}{ the ranges to be encompassed by the x-axis, if NULL they are computed }
  \item{ylim}{ the ranges to be encompassed by the y-axis, if NULL they are computed }
  \item{kgrid}{ a number of points used to locally estimate the level line through the nodes of the grid, 
     used by \code{kgrid*sqrt(length(z))} }
  \item{scale}{ if TRUE, data are centered and reduced }
  \item{grid}{ if TRUE, the background grid is traced }
  \item{addaxes}{ a logical value indicating whether the axes should be plotted }
  \item{cgrid}{ a character size, parameter used with par("cex")* \code{cgrid} to indicate the mesh of the grid }
  \item{include.origin}{ a logical value indicating whether the point "origin" should be belonged to the graph space }
  \item{origin}{ the fixed point in the graph space, for example c(0,0) the origin axes }
  \item{sub}{ a string of characters to be inserted as legend }
  \item{csub}{ a character size for the legend, used with \code{par("cex")*csub} }
  \item{possub}{ a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright") }
  \item{neig}{ an object of class \code{neig} }
  \item{cneig}{ a size for the neighbouring graph lines used with \code{par("lwd")*cneig} }
  \item{image.plot}{ if TRUE, the image is traced }
  \item{contour.plot}{ if TRUE, the contour lines are plotted }
  \item{pixmap}{ an object 'pixmap' displayed in the map background }
  \item{contour}{ a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2) }
  \item{area}{ a data frame of class 'area' to plot a set of surface units in contour }
  \item{add.plot}{ if TRUE uses the current graphics window }
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{

if (require(splancs, quiet = TRUE)){
   wxy=data.frame(expand.grid(-3:3,-3:3))
   names(wxy)=c("x","y")
   z=(1/sqrt(2))*exp(-(wxy$x^2+wxy$y^2)/2)
   par(mfrow=c(2,2))
   s.value(wxy,z)
   s.image(wxy,z)
   s.image(wxy,z,kgrid=5)
   s.image(wxy,z,kgrid=15)
}

\dontrun{
data(t3012)
if (require(splancs, quiet = TRUE)){
    par(mfrow = c(4,4))
    for(k in 1:12)  s.image(t3012$xy,scalewt(t3012$temp[,k]), kgrid = 3)
    par(mfrow = c(1,1))
}
    
data(elec88)
if (require(splancs, quiet = TRUE)){
   par(mfrow = c(4,4))
   for(k in 1:12)
   s.image(t3012$xy, scalewt(t3012$temp[,k]), kgrid = 3, sub = names(t3012$temp)[k],
        csub = 3, area = elec88$area)
    par(mfrow = c(1,1))
}
}
}
\keyword{hplot}

\eof
\name{s.label}
\alias{s.label}
\title{Scatter Plot}
\description{
performs the scatter diagrams with labels. 
}
\usage{
s.label(dfxy, xax = 1, yax = 2, label = row.names(dfxy), 
    clabel = 1, pch = 20, cpoint = if (clabel == 0) 1 else 0, 
    neig = NULL, cneig = 2, xlim = NULL, ylim = NULL, grid = TRUE, 
    addaxes = TRUE, cgrid = 1, include.origin = TRUE, origin = c(0,0), 
    sub = "", csub = 1.25, possub = "bottomleft", pixmap = NULL, 
    contour = NULL, area = NULL, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame with at least two coordinates}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{label}{a vector of strings of characters for the point labels}
  \item{clabel}{if not NULL, a character size for the labels, used with \code{par("cex")*clabel}}
  \item{pch}{if \code{cpoint} > 0, an integer specifying the symbol or the single character to be used in plotting points}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn}
  \item{neig}{a neighbouring graph}
  \item{cneig}{a size for the neighbouring graph lines used with par("lwd")*\code{cneig}}
  \item{xlim}{the ranges to be encompassed by the x axis, if NULL, they are computed}
  \item{ylim}{the ranges to be encompassed by the y axis, if NULL, they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{cgrid}{a character size, parameter used with par("cex")* \code{cgrid} to indicate the mesh of the grid}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{pixmap}{an object 'pixmap' displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
layout(matrix(c(1,2,3,2), 2, 2))
data(atlas)
s.label(atlas$xy, lab = atlas$names.district, 
    area = atlas$area, inc = FALSE, addax = FALSE)
data(mafragh)
s.label(mafragh$xy, inc = FALSE, neig = mafragh$neig, addax = FALSE)
data(irishdata)
s.label(irishdata$xy, inc = FALSE, contour = irishdata$contour, 
    addax = FALSE)

par(mfrow = c(2,2))
cha <- ls()
s.label(cbind.data.frame(runif(length(cha)), 
    runif(length(cha))), lab = cha)
x <- runif(50,-2,2) ; y <- runif(50,-2,2) ; z <- x^2 + y^2
s.label(data.frame(x,y), lab = as.character(z < 1))
s.label(data.frame(x,y), clab = 0, cpoi = 1, add.plot = TRUE)
symbols(0, 0, circles = 1, add = TRUE, inch = FALSE)
s.label(cbind.data.frame(runif(100,0,10), runif(100,5,12)), 
    incl = FALSE, clab = 0)
s.label(cbind.data.frame(runif(100,-3,12),
    runif(100,2,10)), cl = 0, cp = 2, include = FALSE)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.match}
\alias{s.match}
\title{Plot of Paired Coordinates}
\description{
performs the scatter diagram for a paired coordinates. 
}
\usage{
s.match(df1xy, df2xy, xax = 1, yax = 2, pch = 20, cpoint = 1, 
    label = row.names(df1xy), clabel=1, edge = TRUE, xlim = NULL, 
    ylim = NULL, grid = TRUE, addaxes = TRUE, cgrid = 1, 
    include.origin = TRUE, origin = c(0,0), sub = "", csub = 1.25, 
    possub = "bottomleft", pixmap = NULL, contour = NULL, area = NULL, 
    add.plot = FALSE)
}
\arguments{
  \item{df1xy}{a data frame containing two columns from the first system}
  \item{df2xy}{a data frame containing two columns from teh second system}
  \item{xax}{the column number for the x-axis of both the two systems}
  \item{yax}{the column number for the y-axis of both the two systems}
  \item{pch}{if \code{cpoint} > 0, an integer specifying the symbol or the single character to be used in plotting points}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn }
  \item{label}{a vector of strings of characters for the couple labels}
  \item{clabel}{if not NULL, a character size for the labels, used with \code{par("cex")*clabel} }
  \item{edge}{If TRUE the arrows are plotted, otherwise only the segments are drawn}
  \item{xlim}{the ranges to be encompassed by the x axis, if NULL they are computed}
  \item{ylim}{the ranges to be encompassed by the y axis, if NULL they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{cgrid}{a character size, parameter used with par("cex")* \code{cgrid} to indicate the mesh of the grid}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{pixmap}{aan object \code{pixmap} displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
X <- data.frame(x = runif(50,-1,2), y = runif(50,-1,2))
Y <- X + rnorm(100, sd = 0.3)
par(mfrow = c(2,2))
s.match(X, Y)
s.match(X, Y, edge = FALSE, clab = 0)
s.match(X, Y, edge = FALSE, clab = 0)
s.label(X, clab = 1, add.plot = TRUE)
s.label(Y, clab = 0.75, add.plot = TRUE)
s.match(Y, X, clab = 0)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.traject}
\alias{s.traject}
\title{Trajectory Plot}
\description{
performs the scatter diagram with trajectories. 
}
\usage{
s.traject(dfxy, fac = factor(rep(1, nrow(dfxy))), 
    ord = (1:length(fac)),  xax = 1, yax = 2, label = levels(fac), 
    clabel = 1, cpoint = 1, pch = 20, xlim = NULL, ylim = NULL, 
    grid = TRUE, addaxes = TRUE, edge = TRUE, origin = c(0,0), 
    include.origin = TRUE, sub = "", csub = 1, possub = "bottomleft", 
    cgrid = 1, pixmap = NULL, contour = NULL, area = NULL, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame containing two columns for the axes}
  \item{fac}{a factor partioning the rows of the data frame in classes}
  \item{ord}{a vector of length equal to fac. The trajectory is drawn in an ascending order of the ord values}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{label}{a vector of strings of characters for the point labels}
  \item{clabel}{if not NULL, a character size for the labels, used with \code{par("cex")*clabel}}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn}
  \item{pch}{if \code{cpoint} > 0, an integer specifying the symbol or the single character to be used in plotting points}
  \item{xlim}{the ranges to be encompassed by the x, if NULL they are computed}
  \item{ylim}{the ranges to be encompassed by the y, if NULL they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{edge}{if TRUE the arrows are plotted, otherwhise only the segments}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{cgrid}{a character size, parameter used with \code{par("cex")*cgrid} to indicate the mesh of the grid}
  \item{pixmap}{aan object 'pixmap' displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
rw <- function(a){
    x <- 0
    for(i in 1:49) x <- c(x,x[length(x)] + runif(1,-1,1))
    x
}
y <- unlist(lapply(1:5, rw))
x <- unlist(lapply(1:5, rw))
z <- gl(5,50)
s.traject(data.frame(x,y), z, edge = FALSE)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{s.value}
\alias{s.value}
\title{Representation of a value in a graph}
\description{
performs the scatter diagram. 
}
\usage{
s.value(dfxy, z, xax = 1, yax = 2, method = c("squaresize", "greylevel"), 
    zmax=NULL, csize = 1, cpoint = 0, pch = 20, clegend = 0.75, neig = NULL, 
    cneig = 1, xlim = NULL, ylim = NULL, grid = TRUE, addaxes = TRUE, 
    cgrid = 0.75, include.origin = TRUE, origin = c(0,0), sub = "", 
    csub = 1, possub = "topleft", pixmap = NULL, contour = NULL, 
    area = NULL, add.plot = FALSE)
}
\arguments{
  \item{dfxy}{a data frame with two coordinates}
  \item{z}{a vector of the values corresponding to the rows of \code{dfxy}}
  \item{xax}{column for the x axis}
  \item{yax}{column for the y axis}
  \item{method}{a string of characters \cr
    "squaresize" gives black squares for positive values and white for negative values with a proportional area equal to the absolute value.  \cr
    "greylevel" gives squares of equal size with a grey level proportional to the value. By default the first choice}
  \item{zmax}{a numeric value, equal by default to max(abs(z)), can be used to impose a common scale of the size of the squares to several drawings in the same device}
  \item{csize}{a size coefficient for symbols}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn}
  \item{pch}{if \code{cpoint} > 0, an integer specifying the symbol or the single character to be used in plotting points}
  \item{clegend}{a character size for the legend used by \code{par("cex")*clegend}}
  \item{neig}{a neighbouring graph}
  \item{cneig}{a size for the neighbouring graph lines used with \code{par("lwd")*\code{cneig}}}
  \item{xlim}{the ranges to be encompassed by the x, if NULL they are computed}
  \item{ylim}{the ranges to be encompassed by the y, if NULL they are computed}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
  \item{addaxes}{a logical value indicating whether the axes should be plotted}
  \item{cgrid}{a character size, parameter used with \code{par("cex")*cgrid} to indicate the mesh of the grid}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{pixmap}{an object 'pixmap' displayed in the map background}
  \item{contour}{a data frame with 4 columns to plot the contour of the map : each row gives a line (x1,y1,x2,y2)}
  \item{area}{a data frame of class 'area' to plot a set of surface units in contour}
  \item{add.plot}{if TRUE uses the current graphics window}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
xy <- cbind.data.frame(x = runif(500), y = runif(500))
z <- rnorm(500)
s.value(xy, z)

s.value(xy, z, method = "greylevel")

data(rpjdl)
fau.coa <- dudi.coa(rpjdl$fau, scan = FALSE, nf = 3)
s.value(fau.coa$li, fau.coa$li[,3], csi = 0.75, cleg = 0.75)

data(irishdata)
par(mfrow = c(3,4))
irq0 <- data.frame(scale(irishdata$tab, scale = TRUE))
for (i in 1:12) {
    z <- irq0[,i] ; nam <- names(irq0)[i]
    s.value(irishdata$xy, irq0[,1], area = irishdata$area, csi = 3,
    csub = 2, sub = nam, cleg = 1.5, cgrid = 0, inc = FALSE,
    xlim = c(16,205), ylim = c(-50,268), adda = FALSE, grid = FALSE)
}
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{santacatalina}
\alias{santacatalina}
\docType{data}
\title{Indirect Ordination}
\description{
This data set gives the densities per hectare of 11 species of trees 
for 10 transects of topographic moisture values (mean of several stations per class)
}
\usage{data(santacatalina)}
format{
a data frame with 11 rows and 10 columns
}
\source{
Gauch, H. G. J., Chase, G. B. and Whittaker R. H. (1974)
Ordination of vegetation samples by Gaussian species distributions.
\emph{Ecology}, \bold{55}, 1382--1390.
}
\examples{
data(santacatalina)
par(mfrow = c(2,2))
table.value(log(santacatalina + 1), grid = TRUE)
table.value(log(santacatalina + 1)[,sample(10)], grid = TRUE)
coa1 <- dudi.coa(log(santacatalina + 1), scan = FALSE) # 2 factors
table.value(log(santacatalina + 1)[order(coa1$li[,1]), 
    order(coa1$co[,1])], grid = TRUE) 
scatter(coa1, posi = "bottom")
}
\keyword{datasets}

\eof
\name{sarcelles}
\alias{sarcelles}
\docType{data}
\title{Array of Recapture of Rings}
\description{
The data frame \code{sarcelles$tab} contains the number of the winter teals (Anas C. Crecca) for which the ring was retrieved in the area i during the month j (n=3049)
}
\usage{data(sarcelles)}
\format{
    \code{sarcelles} is a list of 4 components.
    \describe{
    \item{tab}{is a data frame with 14 rows-areas and 12 columns-months.}
    \item{xy}{is a data frame with the 2 spatial coordinates of the 14 region centers.}
    \item{neig}{is the neighbouring graph between areas, object of the class \code{neig}.}
    \item{col.names}{is a vector containing the month items}
    }
}
\source{
 Lebreton, J.D. (1973)
 Etude des déplacements saisonniers des Sarcelles d'hiver, 
 Anas c. crecca L., hivernant en Camargue à l'aide de l'analyse factorielle des correspondances.
 \emph{Compte rendu hebdomadaire des séances de l'Académie des sciences}, Paris, D, III, \bold{277}, 2417--2420.
}
\examples{
\dontrun{
# depends of pixmap
if (require(pixmap, quietly=TRUE)) {
    bkgnd.pnm <- read.pnm(system.file("pictures/sarcelles.pnm", package = "ade4"))
    data(sarcelles)
    par(mfrow = c(4,3))
    for(i in 1:12) {
    s.distri(sarcelles$xy, sarcelles$tab[,i], pixmap = bkgnd.pnm, 
       sub = sarcelles$col.names[i], clab = 0, csub = 2)
    s.value(sarcelles$xy, sarcelles$tab[,i], add.plot = TRUE, cleg = 0)
    }
}
}}
\keyword{datasets}

\eof
\name{scalewt}
\alias{scalewt}
\title{Centring and Scaling a Matrix of Any Weighting}
\description{
transforms a numeric matrix in a centred and scaled matrix for any weighting. 
}
\usage{
scalewt(X, wt = rep(1, nrow(X)), center = TRUE, scale = TRUE)
}
\arguments{
  \item{X}{a numeric matrix (like object)}
  \item{wt}{a vector of weighting}
  \item{center}{a logical value indicating whether the array should be centred}
  \item{scale}{a logical value indicating whether the array should be scaled}
}
\value{
returns a centred, scaled matrix
}
\note{The norms are calculated with 1/n and the columns of null variance are still equal to zero.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
scalewt(matrix(1:12,4,3))
scale((matrix(1:12,4,3)))
scale(matrix(1,4,3))
scalewt(matrix(1,4,3))
}
\keyword{utilities}

\eof
\name{scatter}
\alias{scatter}
\alias{scatterutil.base}
\alias{add.scatter.eig}
\alias{scatterutil.chull}
\alias{scatterutil.eigen}
\alias{scatterutil.ellipse}
\alias{scatterutil.eti.circ}
\alias{scatterutil.eti}
\alias{scatterutil.grid}
\alias{scatterutil.legend.bw.square}
\alias{scatterutil.legend.square.grey}
\alias{scatterutil.legendgris}
\alias{scatterutil.scaling}
\alias{scatterutil.star}
\alias{scatterutil.sub}
\title{Scatter Plot}
\description{
scatter is a generic function. It has methods for the classes \code{coa}, \code{dudi}, \code{fca}, \code{acm} and \code{pco}.\cr
The scale of the grid is situated on the right-top of the graph.\cr
The points are in the middle of the labels.\cr
This process plots the graphs of the multivariate analyses.\cr
The two axes have the same scale.\cr
}
\usage{
scatter(x, ...)
}
\arguments{
  \item{x}{an object used to select a method}
  \item{\dots}{further arguments passed to or from other methods}
}
\details{
  The functions scatter use some utilities functions :\cr
  \item{scatterutil.base}{defines the bottom of the plot for all scatters}
  \item{scatterutil.chull}{plots the polygons of the external contour}
  \item{scatterutil.eigen}{plots the eigenvalues bar plot}
  \item{scatterutil.ellipse}{plots an inertia ellipse for a weighting distribution}
  \item{scatterutil.eti.circ}{puts labels on a correlation circle}
  \item{scatterutil.eti}{puts labels centred on the points}
  \item{scatterutil.grid}{plots a grid and adds a legend}
  \item{scatterutil.legend.bw.square}{puts a legend of values by square size}
  \item{scatterutil.legend.square.grey}{puts a legend by squares and grey levels}
  \item{scatterutil.legendgris}{adds a legend of grey levels for the areas}
  \item{scatterutil.scaling}{to fit a plot on a background bipmap}
  \item{scatterutil.star}{plots a star for a weighting distribution}
  \item{scatterutil.sub}{adds a string of characters in sub-title of a graph}
  \item{add.scatter.eig}{adds a eigenvalues bar plot on a graph}
}
\seealso{\code{\link{s.arrow}},\code{\link{s.chull}},\code{\link{s.class}},
\code{\link{s.corcircle}},\code{\link{s.distri}},\code{\link{s.label}},
\code{\link{s.match}},\code{\link{s.traject}},\code{\link{s.value}}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
par(mfrow = c(3,3))
plot.new()
scatterutil.legendgris(1:20, 4, 1.6) 

plot.new()
scatterutil.sub("lkn5555555555lkn", csub = 2, possub = "bottomleft")
scatterutil.sub("lkn5555555555lkn", csub = 1, possub = "topleft")
scatterutil.sub("jdjjl", csub = 3, possub = "topright")
scatterutil.sub("**", csub = 2, possub = "bottomright")

x <- c(0.5,0.2,-0.5,-0.2) ; y <- c(0.2,0.5,-0.2,-0.5)
eti <- c("toto", "kjbk", "gdgiglgl", "sdfg")
plot(x, y, xlim = c(-1,1), ylim = c(-1,1))
scatterutil.eti.circ(x, y, eti, 2.5)
abline(0, 1, lty = 2) ; abline(0, -1, lty = 2)

x <- c(0.5,0.2,-0.5,-0.2) ; y <- c(0.2,0.5,-0.2,-0.5)
eti <- c("toto", "kjbk", "gdgiglgl", "sdfg")
plot(x, y, xlim = c(-1,1), ylim = c(-1,1))
scatterutil.eti(x, y, eti, 1.5)

plot(runif(10,-3,5), runif(10,-1,1), asp = 1)
scatterutil.grid(2)
abline(h = 0, v = 0, lwd = 3)

x <- runif(10,0,1) ; y <- rnorm(10) ; z <- rep(1,10)
plot(x,y) ; scatterutil.star(x, y, z, 0.5)
plot(x,y) ; scatterutil.star(x, y, z, 1)

x <- c(runif(10,0,0.5), runif(10,0.5,1))
y <- runif(20)
plot(x, y, asp = 1) # asp=1 is essential to have perpendicular axes
scatterutil.ellipse(x, y, rep(c(1,0), c(10,10)), cell = 1.5, ax = TRUE)
scatterutil.ellipse(x, y, rep(c(0,1), c(10,10)), cell = 1.5, ax = TRUE)

x <- c(runif(100,0,0.75), runif(100,0.25,1))
y <- c(runif(100,0,0.75), runif(100,0.25,1))
z <- factor(rep(c(1,2), c(100,100)))
plot(x, y, pch = rep(c(1,20), c(100,100)))
scatterutil.chull(x, y, z, opt = c(0.25,0.50,0.75,1))
par(mfrow = c(1,1))
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{scatter.acm}
\alias{scatter.acm}
\title{Plot of the factorial maps in multiple correspondence analysis}
\description{
performs the scatter diagrams of a multiple correspondence analysis. 
}
\usage{
scatter.acm(x, xax = 1, yax = 2, csub = 2, possub = "topleft", ...)
}
\arguments{
  \item{x}{an object of class \code{acm}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the legend position ("topleft", "topright", "bottomleft", "bottomright") in a array of figures}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(lascaux)
scatter(dudi.acm(lascaux$ornem, sca = FALSE), csub = 3)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{scatter.coa}
\alias{scatter.coa}
\title{Plot of the factorial maps for a correspondence analysis}
\description{
performs the scatter diagrams of a correspondence analysis. 
}
\usage{
scatter.coa(x, xax = 1, yax = 2, method = 1:3, clab.row = 0.75, 
    clab.col = 1.25, posieig = "top", sub = NULL, csub = 2, \dots)
}
\arguments{
  \item{x}{an object of class \code{coa}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{method}{an integer between 1 and 3 \cr
    1 Rows and columns with the coordinates of lambda variance\cr
    2 Rows variance 1 and columns by averaging\cr
    3 Columns variance 1 and rows by averaging}
  \item{clab.row}{a character size for the rows}
  \item{clab.col}{a character size for the columns}
  \item{posieig}{if "top" the eigenvalues bar plot is upside,vif "bottom" it is downside, if "none" no plot}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{\dots}{further arguments passed to or from other methods}
}
\references{Oksanen, J. (1987) Problems of joint display of species and site scores in correspondence analysis. \emph{Vegetatio}, \bold{72}, 51--57.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(housetasks)
par(mfrow = c(2,2))
w <- dudi.coa(housetasks, scan = FALSE)
scatter.dudi(w, sub = "0 / To be avoided")
scatter.coa(w, method = 1, sub = "1 / Standard", posieig = "none")
scatter.coa(w, method = 2, 
    sub = "2 / Columns -> averaging -> Rows", posieig = "none")
scatter.coa(w, method = 3, 
    sub = "3 / Rows -> averaging -> Columns ", posieig = "none")
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{scatter.dudi}
\alias{scatter.dudi}
\title{Plot of the Factorial Maps}
\description{
performs the scatter diagrams of objects of class \code{dudi}. 
}
\usage{
scatter.dudi(x, xax = 1, yax = 2, clab.row = 0.75, clab.col = 1, 
    permute = FALSE, posieig = "top", sub = NULL, \dots)
}
\arguments{
  \item{x}{an object of class \code{dudi}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{clab.row}{a character size for the rows}
  \item{clab.col}{a character size for the columns}
  \item{permute}{if FALSE, the rows are plotted by points and the columns by arrows. If TRUE it is the opposite.}
  \item{posieig}{if "top" the eigenvalues bar plot is upside,vif "bottom" it is downside, if "none" no plot}
  \item{sub}{a string of characters to be inserted as legend}
  \item{\dots}{further arguments passed to or from other methods}
}
\details{
\code{scatter.dudi} is a factorial map of individuals and the projection of the vectors of the canonical basis multiplied by a constante of rescaling. In the eigenvalues bar plot,the used axes for the plot are in black, the other kept axes in grey and the other in white.
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(deug)
scatter(dd1 <- dudi.pca(deug$tab, scannf = FALSE, nf = 4), 
    posieig = "bottom")

data(rhone)
dd1 <- dudi.pca(rhone$tab, nf = 4, scann = FALSE)
scatter(dd1, sub = "Principal component analysis")
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{scatter.fca}
\alias{scatter.fca}
\title{Plot of the factorial maps for a fuzzy correspondence analysis}
\description{
performs the scatter diagrams of a fuzzy correspondence analysis. 
}
\usage{
scatter.fca(x, xax = 1, yax = 2, clab.moda = 1, labels = names(x$tab), 
    sub = NULL, csub = 2, \dots)
}
\arguments{
  \item{x}{an object of class \code{fca}}
  \item{xax}{the column number for the x-axis}
  \item{yax}{the column number for the y-axis}
  \item{clab.moda}{the character size to write the modalities}
  \item{labels}{a vector of strings of characters for the labels of the modalities}
  \item{sub}{a vector of strings of characters to be inserted as legend in each figure}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(coleo)
coleo.fuzzy <- prep.fuzzy.var(coleo$tab, coleo$col.blocks)
fca1 <- dudi.fca(coleo.fuzzy, sca = FALSE, nf = 3)
scatter(fca1, labels = coleo$moda.names, clab.moda = 1.5,
    sub = names(coleo$col.blocks), csub = 3)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{sco.boxplot}
\alias{sco.boxplot}
\title{Representation of the link between a variable and a set of qualitative variables}
\description{
represents the link between a variable and a set of qualitative variables. 
}
\usage{
sco.boxplot(score, df, labels = names(df), clabel = 1, xlim = NULL, 
    grid = TRUE, cgrid = 0.75, include.origin = TRUE, origin = 0, 
    sub = NULL, csub = 1)
}
\arguments{
  \item{score}{a numeric vector}
  \item{df}{a data frame with only factors}
  \item{labels}{a vector of strings of characters for the labels of variables}
  \item{clabel}{if not NULL, a character size for the labels, used with  \code{par("cex")*clabel}}
  \item{xlim}{the ranges to be encompassed by the x axis, if NULL they are computed}
  \item{grid}{a logical value indicating whether the scale vertical lines should be drawn}
  \item{cgrid}{a character size, parameter used with \code{par("cex")*cgrid} to indicate the mesh of the scale}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{origin}{the fixed point in the graph space, for example 0 the origin axis}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
w1 <- rnorm(100,-1)
w2 <- rnorm(100)
w3 <- rnorm(100,1)
f1 <- gl(3,100)
f2 <- gl(30,10)
sco.boxplot(c(w1,w2,w3), data.frame(f1,f2))

data(banque)
banque.acm <- dudi.acm(banque, scan = FALSE, nf = 4)
par(mfrow = c(1,3))
sco.boxplot(banque.acm$l1[,1], banque[,1:7], clab = 1.8)
sco.boxplot(banque.acm$l1[,1], banque[,8:14], clab = 1.8)
sco.boxplot(banque.acm$l1[,1], banque[,15:21], clab = 1.8)
par(mfrow = c(1,1))
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{sco.distri}
\alias{sco.distri}
\title{Representation by mean- standard deviation of a set of weight distributions on a numeric score}
\description{
represents the mean- standard deviation of a set of weight distributions on a numeric score. 
}
\usage{
sco.distri(score, df, y.rank = TRUE, csize = 1, labels = names(df), clabel = 1,
    xlim = NULL, grid = TRUE, cgrid = 0.75,
    include.origin = TRUE, origin = 0, sub = NULL, csub = 1)
}
\arguments{
  \item{score}{a numeric vector}
  \item{df}{a data frame with only positive or null values}
  \item{y.rank}{a logical value indicating whether the means should be classified in ascending order}
  \item{csize}{an integer indicating the size segment}
  \item{labels}{a vector of strings of characters for the labels of the variables}
  \item{clabel}{if not NULL, a character size for the labels, used with  \code{par("cex")*clabel}}
  \item{xlim}{the ranges to be encompassed by the x axis, if NULL they are computed}
  \item{grid}{a logical value indicating whether the scale vertical lines should be drawn}
  \item{cgrid}{a character size, parameter used with \code{par("cex")*cgrid} to indicate the mesh of the scale}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{origin}{the fixed point in the graph space, for example c(0,0) the origin axes}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
}
\examples{
w <-seq(-1, 1, le = 200)
distri <- data.frame(lapply(1:50, 
    function(x) sample((200:1)) * ((w >= (-x/50)) & (w <= x/50)) ))
names(distri) <- paste("w", 1:50, sep = "")
par(mfrow = c(1,2))
sco.distri(w, distri, csi = 1.5)
sco.distri(w, distri, y.rank = FALSE, csi = 1.5)
par(mfrow = c(1,1))

data(rpjdl)
coa2 <- dudi.coa(rpjdl$fau, FALSE)
sco.distri(coa2$li[,1], rpjdl$fau, lab = rpjdl$frlab, clab = 0.8)

data(doubs)
par(mfrow = c(2,2))
poi.coa <- dudi.coa(doubs$poi, scann = FALSE)
sco.distri(poi.coa$l1[,1], doubs$poi)
poi.nsc <- dudi.nsc(doubs$poi, scann = FALSE)
sco.distri(poi.nsc$l1[,1], doubs$poi)
s.label(poi.coa$l1)
s.label(poi.nsc$l1)

data(rpjdl)
fau.coa <- dudi.coa(rpjdl$fau, scann = FALSE)
sco.distri(fau.coa$l1[,1], rpjdl$fau)
fau.nsc <- dudi.nsc(rpjdl$fau, scann = FALSE)
sco.distri(fau.nsc$l1[,1], rpjdl$fau)
s.label(fau.coa$l1)
s.label(fau.nsc$l1)

par(mfrow = c(1,1))
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{sco.quant}
\alias{sco.quant}
\title{Graph to Analyse the Relation between a Score and Quantitative Variables}
\description{
represents the graphs to analyse the relation between a score and quantitative variables. 
}
\usage{
sco.quant (score, df, fac = NULL, clabel = 1, abline = FALSE, 
    sub = names(df), csub = 2, possub = "topleft") 
}
\arguments{
  \item{score}{a numeric vector}
  \item{df}{a data frame which rows equal to the score length}
  \item{fac}{a factor with the same length than the score}
  \item{clabel}{character size for the class labels (if any) used with \code{par("cex")*clabel}}
  \item{abline}{a logical value indicating whether a regression line should be added}
  \item{sub}{a vector of strings of characters for the labels of variables}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
}
\examples{
w <- runif(100, -5, 10)
fw <- cut (w, 5)
levels(fw) <- LETTERS[1:5]
wX <- data.frame(matrix(w + rnorm(900, sd = (1:900) / 100), 100, 9))
sco.quant(w, wX, fac = fw, abline = TRUE, clab = 2, csub = 3)
}
\keyword{hplot}
\keyword{multivariate}

\eof
\name{score}
\alias{score}
\alias{scoreutil.base}
\title{Graphs for One Dimension}
\description{
 score is a generic function. It proposes methods for the objects 'coa', 'acm', 'mix', 'pca'.}
\usage{
score(x, ...)
scoreutil.base(y, xlim, grid, cgrid, include.origin, origin, sub, csub) 
}
\arguments{
  \item{x}{an object used to select a method}
  \item{\dots}{further arguments passed to or from other methods}
  \item{y}{a numeric vector}
  \item{xlim}{the ranges to be encompassed by the x axis, if NULL they are computed}
  \item{grid}{a logical value indicating whether the scale vertical lines should be drawn}
  \item{cgrid}{a character size, parameter used with \code{par("cex")*cgrid} to indicate the mesh of the scale}
  \item{include.origin}{a logical value indicating whether the point "origin" should be belonged to the graph space}
  \item{origin}{the fixed point in the graph space, for example 0 the origin axis}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
}
\details{
  \code{scoreutil.base} is a utility function - not for the user - to define the bottom of the layout of all \code{score}.
}
\seealso{\code{\link{sco.boxplot}}, \code{\link{sco.distri}}, \code{\link{sco.quant}}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
\dontrun{
par(mar = c(1,1,1,1))
scoreutil.base (runif(20,3,7), xlim = NULL, grid = TRUE, cgrid = 0.8, 
    include.origin = TRUE, origin = 0, sub = "Uniform", csub = 1)}
# returns the value of the user coordinate of the low line.  
# The user window id defined with c(0,1) in ordinate.
# box()
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{score.acm}
\alias{score.acm}
\title{Graphs to study one factor in a Multiple Correspondence Analysis}
\description{
performs the graphs to study one factor in a Multiple Correspondence Analysis. 
}
\usage{
score.acm(x, xax = 1, which.var = NULL, mfrow = NULL, 
    sub = names(oritab), csub = 2, possub = "topleft", \dots)
}
\arguments{
  \item{x}{an object of class \code{acm}}
  \item{xax}{the column number for the used axis}
  \item{which.var}{the numbers of the kept columns for the analysis, otherwise all columns}
  \item{mfrow}{a vector of the form "c(nr,nc)", otherwise computed by a special own function \code{n2mfrow}}
  \item{sub}{a vector of strings of characters to be inserted as sub-titles, otherwise the variable names of the initial array}
  \item{csub}{a character size for the sub-titles}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{\dots}{further arguments passed to or from other methods}
}
\examples{
data(banque)
banque.acm <- dudi.acm(banque, scann = FALSE, nf = 3)
score(banque.acm, which = which(banque.acm$cr[,1] > 0.2), csub = 3)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{score.coa}
\alias{score.coa}
\title{Graphs to analyse a factor in a correspondence analysis}
\description{
represents the graphs to analyse a factor in a correspondence analysis. 
}
\usage{
score.coa (x, xax = 1, dotchart = FALSE, clab.r = 1, clab.c = 1, 
    csub = 1, cpoi = 1.5, cet = 1.5, ...)
}
\arguments{
  \item{x}{an object of class \code{coa}}
  \item{xax}{the column number for the used axis}
  \item{dotchart}{if TRUE the graph gives a "dual scaling", if FALSE a "reciprocal scaling"}
  \item{clab.r}{a character size for row labels}
  \item{clab.c}{a character size for column labels}
  \item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
  \item{cpoi}{a character size for the points}
  \item{cet}{a coefficient for the size of segments in standard deviation}
  \item{\dots}{further arguments passed to or from other methods}
}
\details{
In a "reciprocal scaling", the reference score is a numeric code centred and normalized of the non zero cells of the array which both maximizes the variance of means by row and by column. The bars are drawn with half the length of this standard deviation.
}
\references{Thioulouse, J. and Chessel D. (1992) A method for reciprocal scaling of species tolerance and sample diversity. \emph{Ecology}, \bold{73}, 670--680.
}
\examples{
layout(matrix(c(1,1,2,3), 2, 2), resp = FALSE)
data(aviurba)
dd1 <- dudi.coa(aviurba$fau, scan = FALSE)
score(dd1, clab.r = 0, clab.c = 0.75)
abline(v = 1, lty = 2, lwd = 3)
sco.distri(dd1$l1[,1], aviurba$fau)
sco.distri(dd1$c1[,1], data.frame(t(aviurba$fau)))

# 1 reciprocal scaling correspondence score -> species amplitude + sample diversity
# 2 sample score -> averaging -> species amplitude
# 3 species score -> averaging -> sample diversity

layout(matrix(c(1,1,2,3), 2, 2), resp = FALSE)
data(rpjdl)
rpjdl1 <- dudi.coa(rpjdl$fau, scan = FALSE)
score(rpjdl1, clab.r = 0, clab.c = 0.75)
if (require(MASS, quietly = TRUE)) {
   data(caith)
   score(dudi.coa(caith, scan = FALSE), clab.r = 1.5, clab.c = 1.5, cpoi = 3)
   data(housetasks)
   score(dudi.coa(housetasks, scan = FALSE), clab.r = 1.25, clab.c = 1.25, 
        csub = 0, cpoi = 3)
}
par(mfrow = c(1,1))
score(rpjdl1, dotchart = TRUE, clab.r = 0)
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{score.mix}
\alias{score.mix}
\title{Graphs to Analyse a factor in a Mixed Analysis}
\description{
represents the graphs to analyse a factor in a mixed analysis. 
}
\usage{
score.mix (x, xax = 1, csub = 2, mfrow = NULL, which.var = NULL, \dots)
}
\arguments{
  \item{x}{an object of class \code{mix}}
  \item{xax}{the column number for the used axis}
  \item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
  \item{mfrow}{a vector of the form "c(nr,nc)", otherwise computed by a special own function \code{n2mfrow}}
  \item{which.var}{the numbers of the kept columns for the analysis, otherwise all columns }
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(lascaux)
w <- cbind.data.frame(lascaux$colo, lascaux$ornem)
dd <- dudi.mix(w, scan = FALSE, nf = 4, add = TRUE)
score(dd, which = which(dd$cr[,1] > 0.3))
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{score.pca}
\alias{score.pca}
\title{Graphs to Analyse a factor in PCA}
\description{
represents the graphs of a factor in a principal component analysis. 
}
\usage{
score.pca(x, xax = 1, which.var = NULL, mfrow = NULL, csub = 2, 
    sub = names(x$tab), abline = TRUE, \dots)
}
\arguments{
  \item{x}{an object of class \code{pca}}
  \item{xax}{the column number for the used axis}
  \item{which.var}{the numbers of the kept columns for the analysis, otherwise all columns}
  \item{mfrow}{a vector of the form "c(nr,nc)", otherwise computed by a special own function \code{n2mfrow}}
  \item{csub}{a character size for sub-titles, used with \code{par("cex")*csub}}
  \item{sub}{a vector of string of characters to be inserted as sub-titles, otherwise the names of the variables}
  \item{abline}{a logical value indicating whether a regression line should be added}
  \item{\dots}{further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}}
\examples{
data(deug)
dd1 <- dudi.pca(deug$tab, scan = FALSE)
score(dd1, csub = 3)
 
# The correlations are :
dd1$co[,1]
# [1] 0.7925 0.6532 0.7410 0.5287 0.5539 0.7416 0.3336 0.2755 0.4172
}
\keyword{multivariate}
\keyword{hplot}

\eof
\name{seconde}
\alias{seconde}
\docType{data}
\title{Students and  Subjects}
\description{
The \code{seconde} data frame gives the marks of 22 students for 8 subjects. 
}
\usage{data(seconde)}
\format{
  This data frame (22,8) contains the following columns:
- HGEO: History and Geography
- FRAN: French literature
- PHYS: Physics
- MATH: Mathematics
- BIOL: Biology
- ECON: Economy
- ANGL: English language
- ESPA: Spanish language
  }
}
\source{
Personal communication
}
\examples{
data(seconde)
scatter(dudi.pca(seconde, scan = FALSE), clab.r = 1, clab.c = 1.5)
}
\keyword{datasets}

\eof
\name{sepan}
\alias{sepan}
\alias{plot.sepan}
\alias{print.sepan}
\alias{summary.sepan}
\title{Separated Analyses in a K-tables}
\description{
performs K separated multivariate analyses of an object of class \code{ktab} 
containing K tables. 
}
\usage{
sepan(X, nf = 2)
plot.sepan (x, mfrow = NULL, csub = 2, \dots)
summary.sepan (object, \dots)
print.sepan (x, \dots)
}
\arguments{
  \item{X}{an object of class \code{ktab}}
  \item{nf}{an integer indicating the number of kept axes for each separated analysis}  
  \item{x, object}{an object of class 'sepan'}
  \item{mfrow}{a vector of the form "c(nr,nc)", otherwise computed by a special own function \code{n2mfrow}}
  \item{csub}{a character size for the sub-titles, used with \code{par("cex")*csub}}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
returns a list of class 'sepan' containing :
  \item{call}{a call order}
  \item{tab.names}{a vector of characters with the names of tables}
  \item{blo}{a numeric vector with the numbers of columns for each table}
  \item{rank}{a numeric vector with the rank of the studied matrix for each table}
  \item{Eig}{a numeric vector with all the eigenvalues}
  \item{Li}{a data frame with the row coordinates}
  \item{L1}{a data frame with the row normed scores}
  \item{Co}{a data frame with the column coordinates}
  \item{C1}{a data frame with the column normed coordinates}
  \item{TL}{a data frame with the factors for Li L1}
  \item{TC}{a data frame with the factors for Co C1}
}
\details{
The function plot on a \code{sepan} object allows to compare inertias and structures between arrays.
In black, the eigenvalues of kept axes in the object 'sepan'.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(escopage)
w <- data.frame(scale(escopage$tab))
w <- ktab.data.frame(w, escopage$blo, tabnames = escopage$tab.names)
sep1 <- sepan(w)
sep1
summary(sep1)
plot(sep1)
}
\keyword{multivariate}

\eof
\name{skulls}
\alias{skulls}
\docType{data}
\title{Morphometric Evolution}
\description{
This data set gives four anthropometric measures of 30 egyptean 
skulls belonging to five different historical periods. 
}
\usage{data(skulls)}
\format{
The \code{skulls} data frame has 150 rows and 4 columns.
The measurements are made on 5 groups and 30 Egyptian skulls. The groups are defined as follows :\cr
1 - the early predynastic period (circa 4000 BC)\cr
2 - the late predynastic period (circa 3300 BC)\cr
3 - the 12th and 13th dynasties (circa 1850 BC)\cr
4 - the Ptolemiac period (circa 200 BC)\cr
5 - the Roman period (circa 150 BC)\cr
}
\source{
Thompson, A. and Randall-Maciver, R. (1905) \emph{Ancient races of the Thebaid}, Oxford University Press.
}
\references{
Manly, B.F. (1994) \emph{Multivariate Statistical Methods. A primer}, 
Second edition. Chapman & Hall, London. 1--215.\cr
The example is treated pp. 6, 13, 51, 64, 72, 107, 112 et 117.
}
\examples{
data(skulls)
pca1 <- dudi.pca(skulls, scan = FALSE)
fac <- gl(5, 30)
levels(fac) <- c("-4000", "-3300", "-1850", "-200", "+150")
dis.skulls <- discrimin(pca1, fac, scan = FALSE)
plot(dis.skulls, 1, 1)
}
\keyword{datasets}

\eof
\name{statis}
\alias{statis}
\alias{print.statis}
\alias{plot.statis}
\title{STATIS, a method for analysing K-tables}
\description{
performs a STATIS analysis of K-tables. 
}
\usage{
statis(X, scannf = TRUE, nf = 3, tol = 1e-07)
plot.statis (x, xax = 1, yax = 2, option = 1:4, \dots) 
print.statis (x, \dots) 
}
\arguments{
  \item{X}{an object of class 'ktab'}
  \item{scannf}{a logical value indicating whether the number of kept axes for the compromise should be asked}
  \item{nf}{if \code{scannf} FALSE, an integer indicating the number of kept axes for the compromise}
  \item{tol}{a tolerance threshold to test whether the distance matrix is Euclidean : an eigenvalue is considered positive if it is larger than \code{-tol*lambda1} where \code{lambda1} is the largest eigenvalue}
  \item{x}{an object of class 'statis'}
  \item{xax, yax}{the numbers of the x-axis and the y-axis}
  \item{option}{an integer between 1 and 4, otherwise the 4 components of the plot are dispayed}
  \item{\dots}{further arguments passed to or from other methods}
}
\value{
\code{statis} returns a list of class 'statis' containing :
  \item{$RV}{a matrix with the all RV coefficients}
  \item{RV.eig}{a numeric vector with all the eigenvalues}
  \item{RV.coo}{a data frame with the array scores}
  \item{tab.names}{a vector of characters with the names of the arrays}
  \item{$RV.tabw}{a numeric vector with the array weigths}
  \item{nf}{an integer indicating the number of kept axes}
  \item{rank}{an integer indicating the rank of the studied matrix}
  \item{C.li}{a data frame with the row coordinates}
  \item{C.Co}{a data frame with the column coordinates}
  \item{T4}{a data frame with the principal vectors (for each table)}
  \item{TL}{a data frame with the factors (not used)}
  \item{TC}{a data frame with the factors for Co}
  \item{T4}{a data frame with the factors for T4}
}
\references{
Lavit, C. (1988) \emph{Analyse conjointe de tableaux quantitatifs}, Masson, Paris.\cr\cr
Lavit, C., Escoufier, Y., Sabatier, R. and Traissac, P. (1994) The ACT (Statis method). \emph{Computational Statistics and Data Analysis}, \bold{18}, 97--119.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(jv73)
kta1 <- ktab.within(within.pca(jv73$morpho, jv73$fac.riv, scann = FALSE))
statis1 <- statis(kta1, scann = FALSE)
plot(statis1)

dudi1 <- dudi.pca(jv73$poi, scann = FALSE, scal = FALSE)
wit1 <- within(dudi1, jv73$fac.riv, scann = FALSE)
kta3 <- ktab.within(wit1)
data(jv73)
statis3 <- statis(kta3, scann = FALSE)
plot(statis3)

s.arrow(statis3$C.li, cgrid = 0)

kplot(statis3, traj = TRUE, arrow = FALSE, unique = TRUE, 
    clab = 0, csub = 3, cpoi = 3)
statis3
}
\keyword{multivariate}

\eof
\name{steppe}
\alias{steppe}
\non_function{}
\title{Transect in the Vegetation}
\description{
This data set gives the presence-absence of 37 species on 515 sites. 
}
\usage{data(steppe)}
\format{
    \code{steppe} is a list of 2 components.
    \describe{
        \item{tab}{is a data frame with 512 rows (sites) and 37 variables (species) in presence-absence.}
        \item{esp.names}{is a vector of the species names.}
    }
}
\source{
Estève, J. (1978) Les méthodes d'ordination : éléments pour une discussion.
in J. M. Legay and R. Tomassone, editors. 
\emph{Biométrie et Ecologie}, Société Française de Biométrie, Paris, 223--250. 
}
\examples{
par(mfrow = c(3,1))
data(steppe)
w1 <- col(as.matrix(steppe$tab[,1:15]))
w1 <- as.numeric(w1[steppe$tab[,1:15] > 0])
w2 <- row(as.matrix(steppe$tab[,1:15]))
w2 <- as.numeric(w2[steppe$tab[,1:15] > 0])
plot(w2, w1, pch = 20)
plot(dudi.pca(steppe$tab, scan = FALSE, scale = FALSE)$li[,1],
    pch = 20, ylab = "PCA", xlab = "", type = "b")
plot(dudi.coa(steppe$tab, scan = FALSE)$li[,1], pch = 20, 
    ylab = "COA", xlab = "", type = "b")
par(mfrow = c(1,1))
}
\keyword{datasets}

\eof
\name{supcol}
\alias{supcol}
\alias{supcol.coa}
\alias{supcol.default}
\title{Projections of Supplementary Columns}
\description{
performs projections of supplementary columns. 
}
\usage{
supcol(x, \dots)
supcol.default (x, Xsup, \dots) 
supcol.coa (x, Xsup, \dots) 
}
\arguments{
  \item{x}{an object used to select a method}
  \item{Xsup}{an array with the supplementary columns (\code{Xsup} and \code{x$tab} have the same row number)}
  \item{\dots}{further arguments passed to or from other methods}
}
\details{
If \code{supcol.default} is used, the column vectors of \code{Xsup} are projected without prior modification onto the principal components of dudi with the scalar product associated to the row weightings of dudi.
}
\value{
returns a list of two components :
\code{$tabsup} {data frame containing the array with the supplementary columns transformed or not}
\code{$cosup} {data frame containing the coordinates of the supplementary projections}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(rpjdl)
rpjdl.coa <- dudi.coa(rpjdl$fau, scan = FALSE, nf = 4)
rpjdl.coa$co[1:3,]
supcol (rpjdl.coa,rpjdl$fau[,1:3])$cosup # the same

data(doubs)
dudi1 <- dudi.pca(doubs$poi, scal = FALSE, scan = FALSE)
s.arrow(dudi1$co)
s.arrow(supcol.default(dudi1,data.frame(scalewt(doubs$mil)))$cosup,
    add.p = TRUE, clab = 2)
symbols(0, 0, circles = 1, inches = FALSE, add = TRUE)
}
\keyword{multivariate}

\eof
\name{suprow}
\alias{suprow}
\alias{suprow.coa}
\alias{suprow.pca}
\alias{suprow.default}
\title{Projections of Supplementary Rows}
\description{
performs projections of supplementary rows. 
}
\usage{ 
suprow.coa (x, Xsup, \dots) 
suprow.default (x, Xsup, \dots) 
suprow.pca (x, Xsup, \dots) 
}
\arguments{
  \item{x}{an object of class \code{dudi}}
  \item{Xsup}{an array with the supplementary rows (\code{Xsup} and \code{x$tab} have the same column number)}
  \item{\dots}{further arguments passed to or from other methods}
}
\details{
If \code{suprow.default} is used, the column vectors of Xsup are projected without prior modifications onto the principal components of dudi with the scalar product associated to the row weightings of dudi.
}
\value{
returns a data frame containing the coordinates of the supplementary projections
}
\references{
Gower, J. C. (1967) Multivariate analysis and multivariate geometry. \emph{The statistician}, \bold{17}, 13--28.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(euro123)
par(mfrow = c(2,2))
w <- euro123[[2]]
dudi1 <- dudi.pca(w, scal = FALSE, scan = FALSE)
s.arrow(dudi1$c1, sub = "Classical", possub = "bottomright", csub = 2.5)
s.label(suprow(dudi1,w), add.plot = TRUE, clab = 0.75)

s.arrow(dudi1$c1,
    sub = "Without centring", possub = "bottomright", csub = 2.5)
s.label(suprow.default(dudi1,w), clab = 0.75, add.plot = TRUE)

triangle.plot(w, clab = 0.75, label = row.names(w), scal = FALSE)
triangle.plot(w, clab = 0.75, label = row.names(w), scal = TRUE)

data(rpjdl)
rpjdl.coa <- dudi.coa(rpjdl$fau, scann = FALSE, nf = 4)
rpjdl.coa$li[1:3,]
suprow(rpjdl.coa,rpjdl$fau[1:3,]) # idem

data(deug)
deug.dudi <- dudi.pca(df = deug$tab, center = deug$cent, 
    scale = FALSE, scannf = FALSE)
suprow(deug.dudi, deug$tab[1:3,]) # the supplementary individuals are centered
deug.dudi$li[1:3,]  # idem
}
\keyword{multivariate}

\eof
\name{symbols.phylog}
\alias{symbols.phylog}
\alias{dotchart.phylog}
\title{Representation of a quantitative variable in front of a phylogenetic tree}
\description{
\code{symbols.phylog} draws the phylogenetic tree and represents the values of the variable by symbols (squares or circles) which size is proportional to value. White symbols correspond to values which are below the mean, and black symbols correspond to values which are over. \cr \cr
\code{dotchart.phylog} represents the phylogenetic tree and draws a Cleveland dot plot of the variable.
}
\usage{
symbols.phylog(phylog, circles, squares, csize = 1, clegend = 1,
 sub = "", csub = 1, possub = "topleft")
dotchart.phylog(phylog, values, ceti = 1, cdot = 1, ...)
}
\arguments{
  \item{phylog}{ an object of class \code{phylog}}
  \item{circles}{ a vector giving the radii of the circles}
  \item{squares}{ a vector giving the length of the sides of the squares}
  \item{values}{a vector giving the position in a \code{dotplot}}
  \item{csize}{ a size coefficient for symbols}
  \item{ceti}{ a character size for the legend of the dot plot, used with \code{par("cex")*ceti}}
  \item{cdot}{ a character size for plotting the points of the dot plot, 
  used with \code{par("cex")*cdot}}
  \item{clegend}{ a character size for the legend used by \code{par("cex")*clegend}}
  \item{sub}{ a string of characters to be inserted as legend}
  \item{csub}{ a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{ a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{\dots}{ further arguments passed to or from other methods}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{table.phylog}} for many variables}
\examples{
data(mjrochet)
mjrochet.phy <- newick2phylog(mjrochet$tre)
tab0 <- data.frame(scalewt(log(mjrochet$tab)))
par(mfrow=c(3,2))
for (j in 1:6) {
    w <- tab0[,j]
    symbols.phylog(phylog = mjrochet.phy, w, csi = 1.5, cleg = 1.5,
     sub = names(tab0)[j], csub = 3)
}
par(mfrow=c(1,1))

par(mfrow=c(2,3))
for (j in 1:6) {
    w <- tab0[,j]
    dotchart.phylog(mjrochet.phy, w, cdot=1.5,
        sub=names(tab0)[j],csub=3,cnodes=2,ceti=1.5)
}
par(mfrow=c(1,1))

}
\keyword{hplot}

\eof
\name{syndicats}
\alias{syndicats}
\docType{data}
\title{Two Questions asked on a Sample of 1000 Respondents}
\description{
This data set is extracted from an opinion poll (period 1970-1980) on 1000 respondents. 
}
\usage{data(syndicats)}
\format{
The \code{syndicats} data frame has 5 rows and 4 columns.\cr
"Which politic family are you agreeing about ?" has 5 response items : 
\code{extgauche} (extreme left) \code{left} \code{center} \code{right} and \code{extdroite} (extreme right)\cr
"What do you think of the trade importance ?" has 4 response items :
\code{trop} (too important) \code{adequate} \code{insufficient} \code{nesaispas} (no opinion)
}
\source{
 unknown
}
\examples{
data(syndicats)
par(mfrow = c(1,2))
dudi1 <- dudi.coa(syndicats, scan = FALSE)
score (dudi1, 1, TRUE)
score (dudi1, 1, FALSE)
}
\keyword{datasets}

\eof
\name{t3012}
\alias{t3012}
\docType{data}
\title{Average temperatures of 30 French cities}
\description{
  This data set gives the average temperatures of 30 French cities during 12 months.
}
\usage{data(t3012)}
\format{
    \code{t3012} is a list of 3 objects:
\describe{
    \item{xy}{is a data frame with 30 rows (cities) and 2 coordinates (x,y).}
    \item{temp}{is a data frame with 30 rows (cities) and 12 columns (months). Each column contains the average temperature in tenth of degree Celsius. }
    \item{contour}{is a data frame with 4 columns (x1,y1,x2,y2) for the contour display of France.}
}}
\source{
Besse, P. (1979)
\emph{Etude descriptive d'un processus; approximation, interpolation}.
 Thèse de troisième cycle, Université Paul Sabatier, Toulouse.
}
\examples{
data(t3012)
data(elec88)
area.plot(elec88$area)
s.arrow(t3012$xy, ori = as.numeric(t3012$xy["Paris",]),
 add.p = TRUE)
}
\keyword{datasets}

\eof
\name{table.cont}
\alias{table.cont}
\title{Plot of Contingency Tables}
\description{
presents a graph for viewing contingency tables. 
}
\usage{
table.cont(df, x = 1:ncol(df), y = 1:nrow(df),
    row.labels = row.names(df), col.labels = names(df),
    clabel.row = 1, clabel.col = 1, abmean.x = FALSE, abline.x = FALSE,
    abmean.y = FALSE, abline.y = FALSE, csize = 1, clegend = 0, grid = TRUE)
}
\arguments{
  \item{df}{a data frame with only positive or null values}
  \item{x}{a vector of values to position the columns}
  \item{y}{a vector of values to position the rows}
  \item{row.labels}{a character vector for the row labels}
  \item{col.labels}{a character vetor for the column labels}
  \item{clabel.row}{a character size for the row labels}
  \item{clabel.col}{a character size for the column labels}
  \item{abmean.x}{a logical value indicating whether the column conditional means should be drawn}
  \item{abline.x}{a logical value indicating whether the regression line of y onto x should be plotted}
  \item{abmean.y}{a logical value indicating whether the row conditional means should be drawn}
  \item{abline.y}{a logical value indicating whether the regression line of x onto y should be plotted}
  \item{csize}{a coefficient for the square size of the values}
  \item{clegend}{if not NULL, a character size for the legend used with  \code{par("cex")*clegend}}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(chats)
chatsw <- data.frame(t(chats))
chatscoa <- dudi.coa(chatsw, scann = FALSE)
par(mfrow = c(2,2))
table.cont(chatsw, abmean.x = TRUE, csi = 2, abline.x = TRUE, 
    clabel.r = 1.5, clabel.c = 1.5)
table.cont(chatsw, abmean.y = TRUE, csi = 2, abline.y = TRUE, 
    clabel.r = 1.5, clabel.c = 1.5)
table.cont(chatsw, x = chatscoa$c1[,1], y = chatscoa$l1[,1],
    abmean.x = TRUE, csi = 2, abline.x = TRUE, clabel.r = 1.5, clabel.c = 1.5)
table.cont(chatsw, x = chatscoa$c1[,1], y = chatscoa$l1[,1],
    abmean.y = TRUE, csi = 2, abline.y = TRUE, clabel.r = 1.5, clabel.c = 1.5)
par(mfrow = c(1,1))

\dontrun{
data(rpjdl)
w <- data.frame(t(rpjdl$fau))
wcoa <- dudi.coa(w, scann = FALSE)
table.cont(w, abmean.y = TRUE, x = wcoa$c1[,1], y = rank(wcoa$l1[,1]),
    csi = 0.2, clabel.c = 0, row.labels = rpjdl$lalab, clabel.r = 0.75)
}}
\keyword{hplot}

\eof
\name{table.dist}
\alias{table.dist}
\title{Graph Display for Distance Matrices}
\description{
presents a graph for viewing distance matrices. 
}
\usage{
table.dist(d, x = 1:(attr(d, "Size")), labels = as.character(x), 
    clabel = 1, csize = 1, grid = TRUE)
}
\arguments{
  \item{d}{an object of class \code{dist}}
  \item{x}{a vector of the row and column positions}
  \item{labels}{a vector of strings of characters for the labels}
  \item{clabel}{a character size for the labels}
  \item{csize}{a coefficient for the circle size}
  \item{grid}{a logical value indicating whether a grid in the background of the plot should be drawn}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(eurodist)
table.dist(eurodist, labels = attr(eurodist, "Labels"))
}
\keyword{hplot}

\eof
\name{table.paint}
\alias{table.paint}
\title{Plot of the arrays by grey levels}
\description{
presents a graph for viewing the numbers of a table by grey levels. 
}
\usage{
table.paint(df, x = 1:ncol(df), y = nrow(df):1, 
    row.labels = row.names(df), col.labels = names(df), 
    clabel.row = 1, clabel.col = 1, csize = 1, clegend = 1)
}
\arguments{
  \item{df}{a data frame}
  \item{x}{a vector of values to position the columns, used only for the ordered values}
  \item{y}{a vector of values to position the rows, used only for the ordered values}
  \item{row.labels}{a character vector for the row labels}
  \item{col.labels}{a character vector for the column labels}
  \item{clabel.row}{a character size for the row labels}
  \item{clabel.col}{a character size for the column labels}
  \item{csize}{if 'clegend' not NULL, a coefficient for the legend size}
  \item{clegend}{a character size for the legend, otherwise no legend}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(rpjdl)
X <- data.frame(t(rpjdl$fau))
Y <- data.frame(t(rpjdl$mil))
layout(matrix(c(1,2,2,2,1,2,2,2,1,2,2,2,1,2,2,2), 4, 4))
coa1 <- dudi.coa(X, scan = FALSE)
x <- rank(coa1$co[,1])
y <- rank(coa1$li[,1])
table.paint(Y, x = x, y = 1:8, clabel.c = 0, cleg = 0)
abline(v = 114.9, lwd = 3, col = "red")
abline(v = 66.4, lwd = 3, col = "red")
table.paint(X, x = x, y = y, clabel.c = 0, cleg = 0,
    row.lab = paste("  ", row.names(X), sep = ""))
abline(v = 114.9, lwd = 3, col = "red")
abline(v = 66.4, lwd = 3, col = "red")
}
\keyword{hplot}

\eof
\name{table.phylog}
\alias{table.phylog}
\title{Plot arrays in front of a phylogenetic tree}
\description{
This function gives a graphical display for viewing the numbers of a table by square sizes in front of the corresponding phylogenetic tree.
}
\usage{
table.phylog(df, phylog, x = 1:ncol(df), f.phylog = 0.5,
 labels.row = gsub("[_]", " ", row.names(df)), clabel.row = 1,
 labels.col = names(df), clabel.col = 1,
 labels.nod = names(phylog$nodes), clabel.nod = 0, cleaves = 1,
 cnodes = 1, csize = 1, grid = TRUE, clegend = 0.75)
}
\arguments{
  \item{df}{: a data frame}
  \item{phylog}{: an object of class \code{'phylog'}}
  \item{x}{: a vector of values to position the columns}
  \item{f.phylog}{: a size coefficient for tree size (a parameter to draw the tree in proportion to leaves labels)}
  \item{labels.row}{: a vector of strings of characters for row labels}
  \item{clabel.row}{: a character size for the leaves labels, used with \code{par("cex")*clabel.row}. If zero, no row labels are drawn}
  \item{labels.col}{: a vector of strings of characters for columns labels}
  \item{clabel.col}{: a character size for the leaves labels, used with \code{par("cex")*clabel.col}. If zero, no column labels are drawn}
  \item{labels.nod}{: a vector of strings of characters for the nodes labels}
  \item{clabel.nod}{: a character size for the nodes labels, used with \code{par("cex")*clabel.nodes}. If zero, no nodes labels are drawn}
  \item{cleaves}{: a character size for plotting the points that represent the leaves, used with \code{par("cex")*cleaves}. If zero, no points are drawn}
  \item{cnodes}{: a character size for plotting the points that represent the nodes, used with \code{par("cex")*cnodes}. If zero, no points are drawn}
  \item{csize}{: a size coefficient for symbols}
  \item{grid}{: a logical value indicating whether the grid should be plotted}
  \item{clegend}{: a character size for the legend (if 0, no legend)}
}
\author{Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr} \cr
Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{symbols.phylog}} for one variable}
\examples{
data(newick.eg)
w.phy <- newick2phylog(newick.eg[[9]])
w.tab <- data.frame(matrix(rnorm(620), 31, 20))
row.names(w.tab) <- sort(names(w.phy$leaves))
table.phylog(w.tab, w.phy, csi = 1.5, f = 0.5,
 clabel.n = 0.75, clabel.c = 0.5)
}
\keyword{hplot}

\eof
\name{table.value}
\alias{table.value}
\alias{table.prepare}
\title{Plot of the Arrays}
\description{
presents a graph for viewing the numbers of a table by square sizes. 
}
\usage{
table.value(df, x = 1:ncol(df), y = nrow(df):1, 
    row.labels = row.names(df), col.labels = names(df), clabel.row = 1, 
    clabel.col = 1, csize = 1, clegend = 1, grid = TRUE)
}
\arguments{
  \item{df}{a data frame}
  \item{x}{a vector of values to position the columns}
  \item{y}{a vector of values to position the rows}
  \item{row.labels}{a character vector for the row labels}
  \item{col.labels}{a character vector for the column labels}
  \item{clabel.row}{a character size for the row labels}
  \item{clabel.col}{a character size for the column labels}
  \item{csize}{a coefficient for the square size of the values}
  \item{clegend}{a character size for the legend (if 0, no legend)}
  \item{grid}{a logical value indicating whether the grid should be plotted}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(olympic)
w <- olympic$tab
w <- data.frame(scale(w))
wpca <- dudi.pca(w, scann = FALSE)
par(mfrow = c(1,3))
table.value(w, csi = 2, clabel.r = 2, clabel.c = 2)
table.value(w, y = rank(wpca$li[,1]), x = rank(wpca$co[,1]), csi = 2,
    clabel.r = 2, clabel.c = 2)
table.value(w, y = wpca$li[,1], x = wpca$co[,1], csi = 2, 
    clabel.r = 2, clabel.c = 2)
par(mfrow = c(1,1))
}
\keyword{hplot}

\eof
\name{tarentaise}
\alias{tarentaise}
\docType{data}
\title{Mountain Avifauna}
\description{
This data set gives informations between sites, species, environmental and biolgoical variables. 
}
\usage{data(tarentaise)}
\format{
    \code{tarentaise} is a list of 5 components.
    \describe{
        \item{ecol}{is a data frame with 376 sites and 98 bird species.}
        \item{frnames}{is a vector of the 98 French names of the species.}
        \item{alti}{is a vector giving the altitude of the 376 sites in m.}
        \item{envir}{is a data frame with 14 environmental variables.}
        \item{traits}{is a data frame with 29 biological variables of the 98 species.}
    }
}
\details{
The attribute \code{col.blocks} of the data frame \code{tarentaise$traits} indicates it is composed of 6 units of variables.
}
\source{
Original data from Hubert Tournier, University of Savoie and Philippe Lebreton, University of Lyon 1.
}
\references{
Lebreton, P., Tournier H. and Lebreton J. D. (1976) 
Etude de l'avifaune du Parc National de la Vanoise 
VI Recherches d'ordre quantitatif sur les Oiseaux forestiers de Vanoise. 
\emph{Travaux Scientifiques du parc National de la vanoise}, \bold{7}, 163--243. 

Lebreton, Ph. and Martinot, J.P. (1998) 
Oiseaux de Vanoise. Guide de l'ornithologue en montagne. 
\emph{Libris}, Grenoble. 1--240. 

Lebreton, Ph., Lebrun, Ph., Martinot, J.P., Miquet, A. and Tournier, H. (1999) 
Approche écologique de l'avifaune de la Vanoise. 
\emph{Travaux scientifiques du Parc national de la Vanoise}, \bold{21}, 7--304.
}
\examples{
data(tarentaise)
coa1 <- dudi.coa(tarentaise$ecol, sca = FALSE, nf = 2)
s.class(coa1$li, tarentaise$envir$alti, wt = coa1$lw)

acm1 <- dudi.acm(tarentaise$envir, sca = FALSE, nf = 2)
s.class(acm1$li, tarentaise$envir$alti)
}
\keyword{datasets}

\eof
\name{taxo.eg}
\alias{taxo.eg}
\docType{data}
\title{Examples of taxonomy}
\description{
This data sets contains two taxonomies.
}
\usage{data(taxo.eg)}
\format{
\code{taxo.eg} is a list containing the 2 following objects: 
\describe{     
        \item{taxo.eg[[1]]}{is a data frame with 15 species and 3 columns.} 
        \item{taxo.eg[[2]]}{is a data frame with 40 species and 2 columns.}
 }}
 \details{       
 Variables of the first data frame are : genre (a factor genre with 8 levels), 
 famille (a factor familiy with 5 levels) and ordre (a factor order with 2 levels).\cr
        
Variables of the second data frame are : gen(a factor genre with 29 levels), 
fam (a factor family with 19 levels).
}
\source{
Dolédec, S., Chessel, D., Ter Braak,C. J. F.  and Champely S. (1996) 
Matching species traits to environmental variables: a new three-table ordination method. 
\emph{Environmental and Ecological Statistics}, \bold{3}, 143--166.
}
\examples{
data(taxo.eg)
taxo.eg[[1]]
as.taxo(taxo.eg[[1]])
class(taxo.eg[[1]])
class(as.taxo(taxo.eg[[1]]))

tax.phy <- taxo2phylog(as.taxo(taxo.eg[[1]]))
plot.phylog(tax.phy,clabel.l=1)

par(mfrow = c(1,2))
table.phylog(tax.phy$Bindica,tax.phy)
table.phylog(tax.phy$Bscores,tax.phy)
par(mfrow = c(1,1))

radial.phylog(taxo2phylog(as.taxo(taxo.eg[[2]])))
}
\keyword{datasets}

\eof
\name{tintoodiel}
\alias{tintoodiel}
\docType{data}
\title{Tinto and Odiel estuary geochemistry}
\description{
This data set contains informations about geochemical characteristics of heavy metal pollution in surface sediments of the Tinto and Odiel river estuary (south-western Spain).  
}
\usage{data(tintoodiel)}
\format{
\code{tintoodiel} is a list containing the following objects : 
\describe{
   \item{xy}{: a data frame that contains spatial coordinates of the 52 sites}   
   \item{tab}{: a data frame with 12 columns (concentration of heavy metals) and 52 rows (sites)}
   \item{neig}{: an object of class \code{neig}}
}}
\source{
Borrego, J., Morales, J.A., de la Torre, M.L. and Grande, J.A. (2002) Geochemical characteristics of heavy metal pollution in surface sediments of the Tinto and Odiel river estuary (south-western Spain). \emph{Environmental Geology}, \bold{41}, 785--796.
}
\examples{
data(tintoodiel)

\dontrun{
if (require(pixmap, quiet = TRUE)){
estuary.pnm <- read.pnm(system.file("pictures/tintoodiel.pnm",
    package = "ade4"))
s.label(tintoodiel$xy,pixmap = estuary.pnm, neig = tintoodiel$neig,
    clab = 0, cpoi = 2, cneig = 3, addax = FALSE, cgrid = 0, grid = FALSE)
}
}

estuary.pca <- dudi.pca(tintoodiel$tab, scan = FALSE, nf = 4)
if (require(maptools, quiet = TRUE) & require(spdep, quiet = TRUE)) {
estuary.listw <- nb2listw(neig2nb(tintoodiel$neig))
estuary.pca.ms <- multispati(estuary.pca, estuary.listw, scan = FALSE,
    nfposi = 3,nfnega = 2)
summary(estuary.pca.ms)
par(mfrow = c(1,2))
barplot(estuary.pca$eig)
barplot(estuary.pca.ms$eig)
par(mfrow = c(1,1))
}
}
\keyword{datasets}

\eof
\name{tithonia}
\alias{tithonia}
\docType{data}
\title{Phylogeny and quantitative traits of flowers}
\description{
This data set describes the phylogeny of 11 flowers as reported by Morales (2000). It also gives morphologic and demographic traits corresponding to these 11 species.
}
\usage{data(tithonia)}
\format{
\code{tithonia} is a list containing the 2 following objects :
\describe{  
   \item{tre}{is a character string giving the phylogenetic tree in Newick format.} 
   \item{tab}{is a data frame with 11 species and 14 traits (6 morphologic traits and 8 demographic).}    
}}
\details{      
Variables of \code{tithonia$tab} are the following ones : \cr
morho1: is a numeric vector that describes the seed size (mm)\cr
morho2: is a numeric vector that describes the flower size (mm)\cr
morho3: is a numeric vector that describes the female leaf size (cm)\cr
morho4: is a numeric vector that describes the head size (mm)\cr
morho5: is a integer vector that describes the number of flowers per head \cr
morho6: is a integer vector that describes the number of seeds per head \cr
demo7: is a numeric vector that describes the seedling height (cm)\cr
demo8: is a numeric vector that describes the growth rate (cm/day)\cr
demo9: is a numeric vector that describes the germination time\cr
demo10: is a numeric vector that describes the establishment (per cent)\cr
demo11: is a numeric vector that describes the viability (per cent)\cr
demo12: is a numeric vector that describes the germination (per cent)\cr
demo13: is a integer vector that describes the resource allocation\cr
demo14: is a numeric vector that describes the adult height (m)\cr
}
\source{
Data were obtained from Morales, E. (2000) Estimating phylogenetic inertia in Tithonia (Asteraceae) : 
a comparative approach. \emph{Evolution}, \bold{54}, 2, 475--484.
}
\examples{
data(tithonia)
phy <- newick2phylog(tithonia$tre)
tab <- log(tithonia$tab + 1)
table.phylog(scalewt(tab), phy)
gearymoran(phy$Wmat, tab)
gearymoran(phy$Amat, tab)
}
\keyword{datasets}

\eof
\name{tortues}
\alias{tortues}
\docType{data}
\title{Morphological Study of the Painted Turtle}
\description{
This data set gives a morphological description (4 characters) of 48 turtles. 
}
\usage{data(tortues)}
\format{
a data frame with 48 rows and 4 columns (length (mm), maximum width(mm), height (mm), gender). 
}
\source{
Jolicoeur, P. and Mosimann, J. E. (1960)
Size and shape variation in the painted turtle. A principal component analysis.
\emph{Growth}, \bold{24}, 339--354.
}
\examples{
data(tortues)
xyz <- as.matrix(tortues[,1:3])
ref <- -svd(xyz)$u[,1]
pch0 <- c(1,20)[as.numeric(tortues$sex)]
plot(ref, xyz[,1], ylim = c(40,180), pch = pch0)
abline(lm(xyz[,1]~ -1 + ref))
points(ref,xyz[,2], pch = pch0)
abline(lm(xyz[,2]~ -1 + ref))
points(ref,xyz[,3], pch = pch0)
abline(lm(xyz[,3]~ -1 + ref))
}
\keyword{datasets}

\eof
\name{toxicity}
\alias{toxicity}
\docType{data}
\title{Homogeneous Table}
\description{
This data set gives the toxicity of 7 molecules on 16 targets
  expressed in -log(mol/liter)
}
\usage{data(toxicity)}
\format{
\code{toxicity} is a list of 3 components.
    \describe{
        \item{tab}{is a data frame with 7 columns and 16 rows}
        \item{species}{is a vector of the names of the species in the 16 targets}
        \item{chemicals}{is a vector of the names of the 7 molecules}
    }
}
\source{
Devillers, J., Thioulouse, J. and Karcher W. (1993)
Chemometrical Evaluation of Multispecies-Multichemical Data by Means 
of Graphical Techniques Combined with Multivariate Analyses.
\emph{Ecotoxicology and Environnemental Safety}, \bold{26}, 333--345.
}
\examples{
data(toxicity)
table.paint(toxicity$tab, row.lab = toxicity$species, 
    col.lab = toxicity$chemicals)

table.value(toxicity$tab, row.lab = toxicity$species, 
    col.lab = toxicity$chemicals)
}
\keyword{datasets}

\eof
\name{triangle.plot}
\alias{triangle.plot}
\alias{triangle.biplot}
\alias{triangle.param}
\alias{triangle.posipoint}
\alias{add.position.triangle}
\title{Triangular Plotting}
\description{
    Graphs for a dataframe with 3 columns of positive or null values\cr
    \code{triangle.plot} is a scatterplot\cr
    \code{triangle.biplot} is a paired scatterplots\cr
    \code{triangle.posipoint}, \code{triangle.param}, \code{add.position.triangle} are utilitaries functions. 
}
\usage{
triangle.plot(ta, label = as.character(1:nrow(ta)), clabel = 0, 
    cpoint = 1, draw.line = TRUE, addaxes = FALSE, addmean = FALSE, 
    labeltriangle = TRUE, sub = "", csub = 0, possub = "topright", 
    show.position = TRUE, scale = TRUE, min3 = NULL, max3 = NULL)
triangle.biplot (ta1, ta2, label = as.character(1:nrow(ta1)), 
    draw.line = TRUE, show.position = TRUE, scale = TRUE)
}
\arguments{
  \item{ta, ta1, ta2,}{data frame with three columns, will be transformed in \bold{percentages} by rows}
  \item{label}{a vector of strings of characters for the point labels}
  \item{clabel}{if not NULL, a character size for the labels, used with  \code{par("cex")*clabel}}
  \item{cpoint}{a character size for plotting the points, used with \code{par("cex")*cpoint}. If zero, no points are drawn}
  \item{draw.line}{a logical value indicating whether the lines into the triangle should be drawn}
  \item{addaxes}{a logical value indicating whether the principal axes should be drawn}
  \item{addmean}{a logical value indicating whether the mean should be plotted}
  \item{labeltriangle}{a logical value indicating whether the variable names should be wrote}
  \item{sub}{a string of characters to be inserted as legend}
  \item{csub}{a character size for the legend, used with \code{par("cex")*csub}}
  \item{possub}{a string of characters indicating the sub-title position ("topleft", "topright", "bottomleft", "bottomright")}
  \item{show.position}{a logical value indicating whether the used triangle should be shown in the complete one}
  \item{scale}{a logical value indicating whether the smaller equilateral triangle containing the plot should be used}
  \item{min3}{If scale is FALSE, a vector of three values for the minima e.g. c(0.1,0.1,0.1) can be used}
  \item{max3}{If scale is FALSE a vector of three values for the maxima e.g. c(0.9,0.9,0.9) can be used}
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data (euro123)
tot <- rbind.data.frame(euro123$in78, euro123$in86, euro123$in97)
row.names(tot) <- paste(row.names(euro123$in78), rep(c(1,2,3), rep(12,3)),
    sep = "")
triangle.plot(tot, label = row.names(tot), clab = 1)

par(mfrow = c(2,2))
triangle.plot(euro123$in78, clab = 0, cpoi = 2, addmean = TRUE, 
    show = FALSE)
triangle.plot(euro123$in86, label = row.names(euro123$in78), clab = 0.8)
triangle.biplot(euro123$in78, euro123$in86)
triangle.plot(rbind.data.frame(euro123$in78, euro123$in86), clab = 1, 
    addaxes = TRUE, sub = "Principal axis", csub = 2, possub = "topright")

triangle.plot(euro123[[1]], min3 = c(0,0.2,0.3), max3 = c(0.5,0.7,0.8),
    clab = 1, label = row.names(euro123[[1]]), addax = TRUE)
triangle.plot(euro123[[2]], min3 = c(0,0.2,0.3), max3 = c(0.5,0.7,0.8), 
    clab = 1, label = row.names(euro123[[1]]), addax = TRUE)
triangle.plot(euro123[[3]], min3 = c(0,0.2,0.3), max3 = c(0.5,0.7,0.8), 
    clab = 1, label = row.names(euro123[[1]]), addax = TRUE)
triangle.plot(rbind.data.frame(euro123[[1]], euro123[[2]], euro123[[3]]))
}
\keyword{hplot}

\eof
\name{trichometeo}
\alias{trichometeo}
\docType{data}
\title{Pair of Ecological Data}
\description{
This data set gives for trappong nights informations about 
species and meteorological variables. 
}
\usage{data(trichometeo)}
\format{
\code{trichometeo} is a list of 3 components.
\describe{
    \item{fau}{is a data frame with 49 rows (trapping nights) and 17 species.}
    \item{meteo}{is a data frame with 49 rows and 11 meteorological variables.}
    \item{cla}{is a factor of 12 levels for the definition of the consecutive night groups}
    }
}
\source{
    Data from P. Usseglio-Polatera
}
\references{
Usseglio-Polatera, P. and Auda, Y. (1987) 
Influence des facteurs météorologiques sur les résultats de piégeage lumineux. 
\emph{Annales de Limnologie}, \bold{23}, 65--79, code des espèces p. 76
}
\examples{
data(trichometeo)
faulog <- log(trichometeo$fau + 1)
pca1 <- dudi.pca(trichometeo$meteo, scan = FALSE)
niche1 <- niche(pca1, faulog, scan = FALSE)
s.label(niche1$ls, clab = 0)
s.distri(niche1$ls, faulog, clab = 0.6, add.p = TRUE, 
    cell = 0, csta = 0.3)
s.arrow(7 * niche1$c1, clab = 1, add.p = TRUE)
}
\keyword{datasets}

\eof
\name{ungulates}
\alias{ungulates}
\docType{data}
\title{Phylogeny and quantitative traits of ungulates.}
\description{
This data set describes the phylogeny of 18 ungulates as reported by Pélabon et al. (1995). It also gives 4 traits corresponding to these 18 species.
}
\usage{data(ungulates)}
\format{
\code{fission} is a list containing the 2 following objects : 
\describe{ 
   \item{tre}{is a character string giving the phylogenetic tree in Newick format.} 
   \item{tab}{is a data frame with 18 species and 4 traits}    
}}
\details{        
Variables of \code{ungulates$tab} are the following ones : \cr
afbw: is a numeric vector that describes the adult female body weight (g) \cr
mnw: is a numeric vector that describes the male neonatal weight (g) \cr
fnw: is a numeric vector that describes the female neonatal weight (g) \cr
ls: is a numeric vector that describes the litter size \cr
}
\source{
Data were obtained from Pélabon, C., Gaillard, J.M., Loison, A. and Portier, A. (1995) 
Is sex-biased maternal care limited by total maternal expenditure in polygynous ungulates? 
\emph{Behavioral Ecology and Sociobiology}, \bold{37}, 311--319.
}
\examples{
data(ungulates)
ung.phy <- newick2phylog(ungulates$tre)
plot.phylog(ung.phy,clabel.l=1.25,clabel.n=0.75)
ung.x <- log(ungulates$tab[,1])
ung.y <- log((ungulates$tab[,2]+ungulates$tab[,3])/2)
names(ung.x) <- names(ung.phy$leaves)
names(ung.y) <- names(ung.x)
plot(ung.x,ung.y)
abline(lm(ung.y~ung.x))
symbols.phylog(ung.phy,ung.x-mean(ung.x))
dotchart.phylog(ung.phy,ung.x,cle=1.5,cno=1.5,cdot=1)
orthogram(ung.x,ung.phy$Bscores,nrep=9999)
ung.z <- residuals(lm(ung.y~ung.x))
names(ung.z) <- names(ung.phy$leaves)
dotchart.phylog(ung.phy,ung.z,cle=1.5,cno=1.5,cdot=1,ceti=0.75)
orthogram(ung.z,ung.phy$Bscores,nrep=9999)
}
\keyword{datasets}

\eof
\name{uniquewt.df}
\alias{uniquewt.df}
\title{Elimination of Duplicated Rows in a Array}
\description{
An utility function to eliminate the duplicated rows in a array. 
}
\usage{
uniquewt.df(x)
}
\arguments{
  \item{x}{a data frame which contains duplicated rows}
}
\value{
The function returns a \code{y} which contains once each duplicated row of \code{x}.\cr
\code{y} is an attribut 'factor' which gives the number of the row of \code{y} in which each row of \code{x} is found\cr
\code{y} is an attribut 'length.class' which gives the number of duplicates in \code{x} with an attribut of each row of \code{y} with an attribut
}
\examples{
data(ecomor)
forsub.r <- uniquewt.df(ecomor$forsub)
attr(forsub.r, "factor")
forsub.r[1,]
ecomor$forsub[126,] #idem

dudi.pca(ecomor$forsub, scale = FALSE, scann = FALSE)$eig
# [1] 0.36845 0.24340 0.15855 0.09052 0.07970 0.04490
w1 <- attr(forsub.r, "len.class") / sum(attr(forsub.r,"len.class"))
dudi.pca(forsub.r, row.w = w1, scale = FALSE, scann = FALSE)$eig
# [1] 0.36845 0.24340 0.15855 0.09052 0.07970 0.04490
}
\keyword{utilities}

\eof
\name{variance.phylog}
\alias{variance.phylog}
\title{The phylogenetic ANOVA}
\description{
This function performs the variance analysis of a trait on eigenvectors associated to a phylogenetic tree.
}
\usage{
variance.phylog(phylog, z, bynames = TRUE,
 na.action = c("fail", "mean"))
}
\arguments{
  \item{phylog}{: an object of class \code{phylog}}
  \item{z}{: a numeric vector of the values corresponding to the variable}
  \item{bynames}{: if TRUE checks if \code{z} labels are the same as \code{phylog} leaves label, possibly in a different order. If FALSE the check is not made and \code{z} labels must be in the same order than \code{phylog} leaves label}
  \item{na.action}{: if 'fail' stops the execution of the current expression when \code{z} contains any missing value. If 'mean' replaces any missing values by mean(\code{z})}
}
\details{
\code{phylog$Amat} defines a set of orthonormal vectors associated the each nodes of the phylogenetic tree. \cr
\code{phylog$Adim} defines the dimension of the subspace \bold{A} defined by 
the first \code{phylog$Adim} vectors of \code{phylog$Amat} that corresponds to phylogenetic inertia. \cr
\code{variance.phylog} performs the linear regression of \code{z} on \bold{A}.
}
\value{
Returns a list containing
  \item{lm}{: an object of class \code{lm} that corresponds to the linear regression of \code{z} on \bold{A}.}
  \item{anova}{: an object of class \code{anova} that corresponds to the anova of the precedent model.}
  \item{smry}{: an object of class \code{table} that is a summary of the precedent object.}
}
\references{
Grafen, A. (1989) The phylogenetic regression. \emph{Philosophical Transactions of the Royal Society London B}, \bold{326}, 119--156.

Diniz-Filho, J. A. F., Sant'Ana, C.E.R. and Bini, L.M. (1998) An eigenvector method for estimating phylogenetic inertia. \emph{Evolution}, \bold{52}, 1247--1262.
}
\author{Sébastien Ollier \email{ollier@biomserv.univ-lyon1.fr} \cr
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\seealso{\code{\link{phylog}}, \code{\link[base]{lm}}}
\examples{
data(njplot)
njplot.phy <- newick2phylog(njplot$tre)
variance.phylog(njplot.phy,njplot$tauxcg)
par(mfrow = c(1,2))
table.phylog(njplot.phy$Ascores, njplot.phy, clabel.row = 0,
 clabel.col = 0.1, clabel.nod = 0.6, csize = 1)
dotchart.phylog(njplot.phy, njplot$tauxcg, clabel.nodes = 0.6)
orthogram(njplot$tauxcg, njplot.phy$Ascores)
}
\keyword{models}

\eof
\name{veuvage}
\alias{veuvage}
\docType{data}
\title{Example for Centring in PCA}
\description{
The data come from the INSEE (National Institute of Statistics and Economical Studies). 
It is an array of widower percentages in relation with the age and the socioprofessional category. 
}
\usage{data(veuvage)}
\format{
    \code{veuvage} is a list of 2 components.
\describe{
   \item{tab}{is a data frame with 37 rows (widowers) 6 columns (socio-professional categories)}
   \item{age}{is a vector of the ages of the 37 widowers. }
    }
}
\details{
The columns contain the socioprofessional categories:\cr
1- Farmers, 2- Craftsmen, 3- Executives and higher intellectual professions,\cr
4- Intermediate Professions, 5- Others white-collar workers and 6- Manual workers.\cr
}
\source{
unknown
}
\examples{
data(veuvage)
par(mfrow = c(3,2))
for (j in 1:6) plot(veuvage$age, veuvage$tab[,j],
    xlab = "âge", ylab = "pourcentage de veufs",
    type = "b", main = names(veuvage$tab)[j])
}
\keyword{datasets}

\eof
\name{westafrica}
\alias{westafrica}
\docType{data}
\title{Freshwater fish zoogeography in west Africa}
\description{
This data set contains informations about faunal similarities between river basins in West africa.  
}
\usage{data(westafrica)}
\format{
\code{westafrica} is a list containing the following objects : 
\describe{
   \item{tab}{: a data frame with absence/presence of 268 species (rows) at 33 embouchures (columns)}
   \item{spe.names}{: a vector of string of characters with the name of species}
   \item{spe.binames}{: a data frame with the genus and species (columns) of the 256 species (rows)}
   \item{riv.names}{: a vector of string of characters with the name of rivers}
   \item{atlantic}{: a data frame with the coordinates of a polygon that represents the limits of atlantic (see example)}
   \item{riv.xy}{: a data frame with the coordinates of embouchures}
   \item{lines}{: a data frame with the coordinates of lines to complete the representation (see example)}
   \item{cadre}{: a data frame with the coordinates of points used to make the representation (see example)}   
}}
\source{
Data provided by B. Hugueny \email{hugueny@biomserv.univ-lyon1.fr}.

Paugy, D., Traoré, K. and Diouf, P.F. (1994) Faune ichtyologique des eaux douces d'Afrique de l'Ouest. 
In \emph{Diversité biologique des poissons des eaux douces et saumâtres d'Afrique. Synthèses géographiques}, 
Teugels, G.G., Guégan, J.F. and Albaret, J.J. (Editors). Annales du Musée Royal de l'Afrique Centrale,  
Zoologie, N° 275, Tervuren, Belgique, 35--66.

Hugueny, B. (1989) \emph{Biogéographie et structure des peuplements de Poissons d'eau douce de l'Afrique de l'ouest : 
approches quantitatives}. Thèse de doctorat, Université Paris 7.
}
\references{
Hugueny, B., and Lévêque, C. (1994) Freshwater fish zoogeography in west Africa: faunal similarities between river basins. \emph{Environmental Biology of Fishes}, \bold{39}, 365--380.
}
\examples{
data(westafrica)

s.label(westafrica$cadre, xlim = c(30,500), ylim = c(50,290),
    cpoi = 0, clab = 0, grid = FALSE, addax = 0)
old.par <- par(no.readonly = TRUE)
par(mar = c(0.1, 0.1, 0.1, 0.1))
rect(30,0,500,290)
polygon(westafrica$atlantic,col = "lightblue")
points(westafrica$riv.xy, pch = 20, cex = 1.5)
apply(westafrica$lines, 1, function(x) segments(x[1], x[2], x[3],
    x[4], lwd = 1))
apply(westafrica$riv.xy,1, function(x) segments(x[1], x[2], x[3],
    x[4], lwd = 1))
text(c(175,260,460,420), c(275,200,250,100), c("Senegal","Niger",
    "Niger","Volta"))
par(srt = 270)
text(westafrica$riv.xy$x2, westafrica$riv.xy$y2-10, 
    westafrica$riv.names, adj = 0, cex = 0.75)
par(old.par)
rm(old.par)

# multivariate analysis
afri.w <- data.frame(t(westafrica$tab))
afri.dist <- dist.binary(afri.w,1)
afri.pco <- dudi.pco(afri.dist, scan = FALSE, nf = 3)
par(mfrow = c(3,1))
barplot(afri.pco$li[,1])
barplot(afri.pco$li[,2])
barplot(afri.pco$li[,3])

if (require(spdep, quiet = TRUE)){
    #multivariate spatial analysis
    afri.neig <- neig(n.line = 33)
    afri.nb <- neig2nb(afri.neig)
    afri.listw <- nb2listw(afri.nb)
    afri.ms <- multispati(afri.pco, afri.listw, scan = FALSE,
        nfposi = 6, nfnega = 0)
    par(mfrow = c(3,1))
    barplot(afri.ms$li[,1])
    barplot(afri.ms$li[,2])
    barplot(afri.ms$li[,3])

    par(mfrow = c(2,2))
    s.label(afri.ms$li, clab = 0.75, cpoi = 0, neig = afri.neig,
       cneig = 1.5)
    s.value(afri.ms$li, afri.ms$li[,3])
    s.value(afri.ms$li, afri.ms$li[,4])
    s.value(afri.ms$li, afri.ms$li[,5])
    summary(afri.ms)
}

par(mfrow = c(1,1))
library(mva)
plot(hclust(afri.dist,"ward"),h=-0.2)
}
\keyword{datasets}

\eof
\name{within}
\alias{within}
\alias{print.within}
\alias{plot.within}
\title{Within Analyses}
\description{
performs within analyses on an object of class \code{dudi}. 
}
\usage{
within(dudi, fac, scannf = TRUE, nf = 2) 
plot.within (x, xax = 1, yax = 2, \dots) 
print.within (x, \dots)
}
\arguments{
 \item{dudi}{an object of class \code{dudi}}
 \item{fac}{a factor distributing the rows of \code{dudi$tab} in classes }
 \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
 \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
 \item{xax}{the column number for the x-axis}
 \item{yax}{the column number for the y-axis}
 \item{x}{an object of class 'within'}
 \item{\dots}{further arguments passed to or from other methods}
}
\value{
Returns a list of the sub-class \code{within} in the class \code{dudi}
  \item{call}{origine}
  \item{nf}{number of axis saved}
  \item{rank}{rank}
  \item{ratio}{percentage of within inertia}
  \item{eig}{numeric eigen values}
  \item{lw}{numeric row weigths}
  \item{cw}{numeric col weigths}
  \item{tabw}{numeric table weigths}
  \item{fac}{factor for grouping}
  \item{tab}{data frame class-variables}
  \item{li}{data frame row coordinates}
  \item{l1}{data frame row normed scores} 
  \item{co}{data frame column coordinates}
  \item{$c1}{data frame column normed scores}
  \item{ls}{data frame supplementary row coordinates}
  \item{as}{data frame inertia axis onto within axis}
}
\references{
Benzécri, J. P. (1983) Analyse de l'inertie intra-classe par l'analyse d'un tableau de correspondances. \emph{Les Cahiers de l'Analyse des données}, \bold{8}, 351--358.\cr\cr
Dolédec, S. and Chessel, D. (1987) Rythmes saisonniers et composantes stationnelles en milieu aquatique I- Description d'un plan d'observations complet par projection de variables. \emph{Acta Oecologica, Oecologia Generalis}, \bold{8}, 3, 403--426.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(meaudret)
par(mfrow = c(2,2))
pca1 <- dudi.pca(meaudret$mil, scan = FALSE, nf = 4)
s.traject(pca1$li, meaudret$plan$sta, 
    sub = "Principal Component Analysis", csub = 1.5)
wit1 <- within(pca1, meaudret$plan$sta, scan = FALSE, nf = 2)
s.traject(wit1$li, meaudret$plan$sta, 
    sub = "Within site Principal Component Analysis", csub = 1.5)
s.corcircle (wit1$as)
par(mfrow = c(1,1))
plot(wit1)
}
\keyword{multivariate}

\eof
\name{within.pca}
\alias{within.pca}
\title{Normed within Principal Component Analysis}
\description{
performs a normed within principal component analysis. 
}
\usage{
within.pca(df, fac, scaling = c("partial", "total"), 
    scannf = TRUE, nf = 2)
}
\arguments{
  \item{df}{a data frame with quantitative variables}
  \item{fac}{a factor distributing the rows of df in classes}
  \item{scaling}{a string of characters as a scaling option : \cr
    if "partial", for each factor level, the sub-array is centred and normed.\cr
    If "total", for each factor level, the sub-array is centred and the total array is then normed.}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
}
\value{
returns a list of the sub-class \code{within} of class \code{dudi'}. See \code{\link{within}}
}
\references{Bouroche, J. M. (1975) \emph{Analyse des données ternaires: la double analyse en composantes principales}. 
 Thèse de 3ème cycle, Université de Paris VI.
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(meaudret)
wit1 <- within.pca(meaudret$mil, meaudret$plan$dat, 
    scan = FALSE, scal = "partial")
kta1 <- ktab.within(wit1, colnames = rep(c("S1","S2","S3","S4","S5"), 4))
unclass(kta1)
# See pta
plot(wit1)
}
\keyword{multivariate}

\eof
\name{witwit.coa}
\alias{witwit.coa}
\alias{summary.witwit}
\title{Internal Correspondence Analysis}
\description{
performs an Internal Correspondence Analysis. 
}
\usage{
witwit.coa(dudi, row.blocks, col.blocks, scannf = TRUE, nf = 2)
summary.witwit(object, \dots)
}
\arguments{
  \item{dudi}{an object of class \code{coa} }
  \item{row.blocks}{a numeric vector indicating the row numbers for each block of rows}
  \item{col.blocks}{a numeric vector indicating the column numbers for each block of columns}
  \item{scannf}{a logical value indicating whether the eigenvalues bar plot should be displayed}
  \item{nf}{if scannf FALSE, an integer indicating the number of kept axes}
  \cr
  \item{object}{an object of class \code{witwit}}
  \item{\dots}{further arguments passed to or from other methods}
}
value{
returns a list of class \code{witwit}, \code{coa} and \code{dudi} (see \link{as.dudi}) containing
  \item{rbvar}{a data frame with the within variances of the rows of the factorial coordinates}
  \item{lbw}{a data frame with the marginal weighting of the row classes}
  \item{cvar}{a data frame with the within variances of the columns of the factorial coordinates}
  \item{cbw}{a data frame with the marginal weighting of the column classes}
}
\references{
Cazes, P., Chessel, D. and Dolédec, S. (1988) L'analyse des correspondances internes d'un tableau partitionné :
son usage en hydrobiologie. \emph{Revue de Statistique Appliquée}, \bold{36}, 39--54. 
}
\author{
Daniel Chessel \email{chessel@biomserv.univ-lyon1.fr}
}
\examples{
data(ardeche)
coa1 <- dudi.coa(ardeche$tab, scann = FALSE, nf = 4)
ww <- witwit.coa(coa1, ardeche$row.blocks, ardeche$col.blocks, scann = FALSE)
ww
s.class(ww$co, ardeche$sta.fac, clab = 1.5, cell = 0, axesell = FALSE)
s.label(ww$co, add.p = TRUE, clab = 0.75)
summary(ww)
}
\keyword{multivariate}

\eof
\name{worksurv}
\alias{worksurv}
\docType{data}
\title{French Worker Survey (1970)}
\description{
The \code{worksurv} data frame gives 319 response items and 4 questions 
providing from a French Worker Survey. 
}
\usage{data(worksurv)}
\format{
  This data frame contains the following columns:
  \enumerate{
    \item{pro}{Professional elections. In professional elections in your firm, would you rather vote for a list supported by?
   \code{CGT}
      \code{CFDT}
      \code{FO}
      \code{CFTC}
      \code{Auton} Autonomous
      \code{Abst}
      \code{Nonaffi} Not affiliated
      \code{NR} No response}
    \item{una}{Union affiliation. At the present time, are you affiliated to a Union, and in the affirmative, which one?
      \code{CGT}
      \code{CFDT}
      \code{FO}
      \code{CFTC}
      \code{Auton} Autonomous
      \code{CGC}
      \code{Notaffi} Not affiliated
      \code{NR} No response}
    \item{pre}{Presidential election. On the last presidential election (1969), can you tell me the candidate for whom you have voted?
      \code{Duclos}
      \code{Deferre}
      \code{Krivine}
      \code{Rocard}
      \code{Poher}
      \code{Ducatel}
      \code{Pompidou}
      \code{NRAbs} No response, abstention}
    \item{pol}{political sympathy. Which political party do you feel closest to, as a rule ?
      \code{Communist} (PCF)
      \code{Socialist} (SFIO+PSU+FGDS)
      \code{Left} (Party of workers",\dots)
      \code{Center} MRP+RAD.
      \code{RI}
      \code{Right} INDEP.+CNI
      \code{Gaullist} UNR
      \code{NR} No response}
  }
}
\details{
The data frame \code{worksurv} has the attribute 'counts' giving the number of responses for each item.
}
\source{
Rouanet, H. and Le Roux, B. (1993) 
\emph{Analyse des données multidimensionnelles}. Dunod, Paris.
}
\references{
Le Roux, B. and Rouanet, H.  (1997) 
Interpreting axes in multiple correspondence analysis: method of the contributions of points and deviation. 
Pages 197-220 in B. J. and M. Greenacre, editors. 
\emph{Visualization of categorical data}, Acamedic Press, London.
}
\examples{
data(worksurv)
acm1 <- dudi.acm(worksurv, row.w = attr(worksurv,"counts"), 
    scan = FALSE)
par(mfrow = c(2,2))
apply(worksurv,2, function(x) s.class(acm1$li, factor(x),
    attr(worksurv, 'counts')))
}
\keyword{datasets}

\eof
\name{yanomama}
\alias{yanomama}
\docType{data}
\title{Distance Matrices}
\description{
This data set gives 3 matrices about geographical, genetic and anthropometric distances. 
}
\usage{data(yanomama)}
\format{
    \code{yanomama} is a list of 3 components:
\describe{
   \item{geo}{is a matrix of 19-19 geographical distances}
   \item{gen}{is a matrix of 19-19 SFA (genetic) distances}
   \item{ant}{is a matrix of 19-19 anthropometric distances}
    }
}
\source{
Spielman, R.S. (1973) 
Differences among Yanomama Indian villages: do the patterns of allele frequencies, anthropometrics and map locations correspond? 
\emph{American Journal of Physical Anthropology}, \bold{39}, 461--480.
}
\references{
Table 7.2 Distance matrices for 19 villages of Yanomama Indians. 
All distances are as given by Spielman (1973), multiplied by 100 for convenience in: 
Manly, B.F.J. (1991) 
\emph{Randomization and Monte Carlo methods in biology} 
Chapman and Hall, London, 1--281.
}
\examples{
library(mva)
    data(yanomama)
    gen <- quasieuclid(as.dist(yanomama$gen)) # depends of mva
    ant <- quasieuclid(as.dist(yanomama$ant)) # depends of mva
    par(mfrow = c(2,2))
    plot(gen, ant)
    t1 <- mantel.randtest(gen, ant, 99);
    plot(t1, main = "gen-ant-mantel") ; print(t1)
    t1 <- procuste.rtest(pcoscaled(gen), pcoscaled(ant), 99)
    plot(t1, main = "gen-ant-procuste") ; print(t1)
    t1 <- RV.rtest(pcoscaled(gen), pcoscaled(ant), 99)
    plot(t1, main = "gen-ant-RV") ; print(t1)
}
\keyword{datasets}

\eof
\name{zealand}
\alias{zealand}
\docType{data}
\title{Road distances in New-Zealand}
\description{
  This data set gives the road distances between 13 towns
  in New-Zealand.
}
\usage{data(zealand)}
\format{
    \code{zealand} is a list of 3 components:
\describe{
    \item{road}{is a data frame with 13 rows (New Zealand towns) and 13 columns (New Zealand towns)
    containing the road distances between these towns.}
    \item{xy}{is a data frame containing the coordinates of the 13 towns. }
    \item{neig}{is a object of class 'neig', a neighbour graph to visualize the map shape.}
}}
\source{
 Manly, B.F. (1994) \emph{ Multivariate Statistical Methods. A primer.}, Second edition, Chapman and Hall, London, 1--215, page 172.
}
\examples{
data(zealand)

d0 = mat2dist(as.matrix(zealand$road))
d1 = cailliez (d0)
d2 = lingoes(d0)
s.label(zealand$xy,lab=as.character(1:13),neig=zealand$neig)
par(mfrow = c(2,2))
library(mva)
    s.label(cmdscale(dist(zealand$xy)),lab = as.character(1:13),
     neig = zealand$neig, sub = "Distance canonique", csub = 2)
    s.label(cmdscale(d0), lab = as.character(1:13), neig = zealand$neig,
        sub = "Distance routière", csub = 2)
    s.label(cmdscale(d1), lab = as.character(1:13), neig = zealand$neig,
        sub = "Distance routière / Cailliez", csub = 2)
    s.label(cmdscale(d2), lab = as.character(1:13), neig = zealand$neig,
        sub = "Distance routière / Lingoës", csub = 2)
}
\keyword{datasets}

\eof
