File: group_data.Rd

package info (click to toggle)
r-cran-dplyr 1.1.4-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,292 kB
  • sloc: cpp: 1,403; sh: 17; makefile: 7
file content (72 lines) | stat: -rw-r--r-- 1,896 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/group-data.R
\name{group_data}
\alias{group_data}
\alias{group_keys}
\alias{group_rows}
\alias{group_indices}
\alias{group_vars}
\alias{groups}
\alias{group_size}
\alias{n_groups}
\title{Grouping metadata}
\usage{
group_data(.data)

group_keys(.tbl, ...)

group_rows(.data)

group_indices(.data, ...)

group_vars(x)

groups(x)

group_size(x)

n_groups(x)
}
\arguments{
\item{.data, .tbl, x}{A data frame or extension (like a tibble or grouped
tibble).}

\item{...}{Use of \code{...} is now deprecated; please use \code{group_by()} first
instead.}
}
\description{
This collection of functions accesses data about grouped data frames in
various ways:
\itemize{
\item \code{group_data()} returns a data frame that defines the grouping structure.
The columns give the values of the grouping variables. The last column,
always called \code{.rows}, is a list of integer vectors that gives the
location of the rows in each group.
\item \code{group_keys()} returns a data frame describing the groups.
\item \code{group_rows()} returns a list of integer vectors giving the rows that
each group contains.
\item \code{group_indices()} returns an integer vector the same length as \code{.data}
that gives the group that each row belongs to.
\item \code{group_vars()} gives names of grouping variables as character vector.
\item \code{groups()} gives the names of the grouping variables as a list of symbols.
\item \code{group_size()} gives the size of each group.
\item \code{n_groups()} gives the total number of groups.
}

See \link{context} for equivalent functions that return values for the \emph{current}
group.
}
\examples{
df <- tibble(x = c(1,1,2,2))
group_vars(df)
group_rows(df)
group_data(df)
group_indices(df)

gf <- group_by(df, x)
group_vars(gf)
group_rows(gf)
group_data(gf)
group_indices(gf)
}
\keyword{internal}