The R Project SVN R

Rev

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

Rev 83041 Rev 87087
Line 1... Line 1...
1
\name{asplit}
1
\name{asplit}
2
\alias{asplit}
2
\alias{asplit}
3
\title{Split Array/Matrix By Its Margins}
3
\title{Split Array/Matrix By Its Margins}
4
\description{Split an array or matrix by its margins.}
4
\description{Split an array or matrix by its margins.}
5
\usage{
5
\usage{
6
asplit(x, MARGIN)
6
asplit(x, MARGIN, drop = FALSE)
7
}
7
}
8
\arguments{
8
\arguments{
9
  \item{x}{an array, including a matrix.}
9
  \item{x}{an array, including a matrix.}
10
  \item{MARGIN}{a vector giving the margins to split by.
10
  \item{MARGIN}{a vector giving the margins to split by.
11
    E.g., for a matrix \code{1} indicates rows, \code{2} indicates
11
    E.g., for a matrix \code{1} indicates rows, \code{2} indicates
12
    columns, \code{c(1, 2)} indicates rows and columns.
12
    columns, \code{c(1, 2)} indicates rows and columns.
13
    Where \code{x} has named dimnames, it can be a character vector
13
    Where \code{x} has named dimnames, it can be a character vector
14
    selecting dimension names.}
14
    selecting dimension names.}
-
 
15
  \item{drop}{a logical indicating whether the splits should drop
-
 
16
    dimensions and dimnames.}
15
}
17
}
16
\value{
18
\value{
17
  A \dQuote{list array} with dimension \eqn{dv} and each element an
19
  A \dQuote{list array} with dimension \eqn{dv} and each element an
18
  array of dimension \eqn{de} and dimnames preserved as available, where
20
  array of dimension \eqn{de} and dimnames preserved as available if
-
 
21
  \code{drop} is false and a vector otherwise, where
19
  \eqn{dv} and \eqn{de} are, respectively, the dimensions of \code{x}
22
  \eqn{dv} and \eqn{de} are, respectively, the dimensions of \code{x}
20
  included and not included in \code{MARGIN}.
23
  included and not included in \code{MARGIN}.
21
}
24
}
22
\details{
25
\details{
23
  Since \R 4.1.0, one can also obtain the splits (less efficiently)
26
  Since \R 4.1.0, one can also obtain the splits (less efficiently)