The R Project SVN R

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
7709 pd 1
\name{margin.table}
15168 pd 2
\alias{margin.table}
7709 pd 3
\title{Compute table margin}
15168 pd 4
\description{
5
  For a contingency table in array form, compute the sum of table
6
  entries for a given index.
7
}
7709 pd 8
\usage{
11040 pd 9
margin.table(x, margin=NULL)
7709 pd 10
}
11
\arguments{
10443 hornik 12
  \item{x}{an array}
13
  \item{margin}{index number (1 for rows, etc.) }
7709 pd 14
}
15
\details{
15168 pd 16
  This is really just \code{apply(x, margin, sum)} packaged up for
11040 pd 17
  newbies, except that if \code{margin} has length zero you get
18
  \code{sum(x)}.
7709 pd 19
}
20
\value{
15168 pd 21
  The relevant marginal table.  The class of \code{x} is copied to the
22
  output table, except in the summation case.
7709 pd 23
}
10443 hornik 24
\author{Peter Dalgaard}
7709 pd 25
\examples{
26
m<-matrix(1:4,2)
27
margin.table(m,1)
28
margin.table(m,2)
29
}
10443 hornik 30
\keyword{array}