The R Project SVN R

Rev

Rev 61168 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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