The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
42333 ripley 1
% File src/library/base/man/margin.table.Rd
2
% Part of the R package, http://www.R-project.org
59039 ripley 3
% Copyright 1995-2007 R Core Team
42333 ripley 4
% Distributed under GPL 2 or later
5
 
7709 pd 6
\name{margin.table}
56186 murdoch 7
\alias{margin.table}
7709 pd 8
\title{Compute table margin}
15168 pd 9
\description{
10
  For a contingency table in array form, compute the sum of table
11
  entries for a given index.
12
}
7709 pd 13
\usage{
61150 ripley 14
margin.table(x, margin = NULL)
7709 pd 15
}
16
\arguments{
10443 hornik 17
  \item{x}{an array}
18
  \item{margin}{index number (1 for rows, etc.) }
7709 pd 19
}
20
\details{
15168 pd 21
  This is really just \code{apply(x, margin, sum)} packaged up for
11040 pd 22
  newbies, except that if \code{margin} has length zero you get
23
  \code{sum(x)}.
7709 pd 24
}
38483 maechler 25
\seealso{
49566 ripley 26
  \code{\link{prop.table}} and \code{\link{addmargins}}.
38483 maechler 27
}
7709 pd 28
\value{
15168 pd 29
  The relevant marginal table.  The class of \code{x} is copied to the
30
  output table, except in the summation case.
7709 pd 31
}
10443 hornik 32
\author{Peter Dalgaard}
7709 pd 33
\examples{
61168 ripley 34
m <- matrix(1:4, 2)
35
margin.table(m, 1)
36
margin.table(m, 2)
7709 pd 37
}
10443 hornik 38
\keyword{array}