File: multisplit.Rd

package info (click to toggle)
r-bioc-iranges 2.16.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,808 kB
  • sloc: ansic: 4,789; sh: 4; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
\name{multisplit}
\alias{multisplit}

\title{
  Split elements belonging to multiple groups
}

\description{
  This is like \code{\link{split}}, except elements can belong to
  multiple groups, in which case they are repeated to appear in multiple
  elements of the return value.
}

\usage{
multisplit(x, f)
}

\arguments{
  \item{x}{
    The object to split, like a vector.
  }
  \item{f}{
    A list-like object of vectors, the same length as \code{x}, where
    each element indicates the groups to which each element of \code{x}
    belongs.
  }
}

\value{
  A list-like object, with an element for each unique value in the
  unlisted \code{f}, containing the elements in \code{x} where the
  corresponding element in \code{f} contained that value. Just try it.
}

\author{
  Michael Lawrence
}

\examples{
multisplit(1:3, list(letters[1:2], letters[2:3], letters[2:4]))
}

\keyword{ manip }