The R Project SVN R

Rev

Rev 11040 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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