File: DataFrame-utils.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 (53 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download
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
44
45
46
47
48
49
50
51
52
53
\name{DataFrame-utils}

\alias{DataFrame-utils}

\alias{relistToClass,DataFrame-method}
\alias{relistToClass,data.frame-method}

% splitting
\alias{mstack,DataFrame-method}


\title{Common operations on DataFrame objects}

\description{
  Common operations on \link{DataFrame} objects.
}

\section{Splitting}{
  In the following code snippets, \code{x} is a \code{DataFrame}.
  
  \describe{
    \item{}{\code{split(x, f, drop = FALSE)}:
      Splits \code{x} into a \code{\linkS4class{CompressedSplitDataFrameList}},
      according to \code{f}, dropping elements corresponding to
      unrepresented levels if \code{drop} is \code{TRUE}.
    }
    \item{}{
      \code{mstack(..., .index.var = "name")}: Stacks the data frames
      passed as through \dots, using \code{.index.var} as the index
      column name. See \code{\link{stack}}.
    }
  }
}

\author{ Michael Lawrence }
\seealso{
  \code{\linkS4class{DataTable}} and \code{\linkS4class{Vector}}
}
\examples{
## split

sw <- DataFrame(swiss)
swsplit <- split(sw, sw[["Education"]])
  
## rbind

do.call(rbind, as.list(swsplit))

## cbind

cbind(DataFrame(score), DataFrame(counts))
}
\keyword{methods}