group_metadata: Grouping metadata

group_metadataR Documentation

Grouping metadata

Description

  • 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 .rows, is a list of integer vectors that gives the location of the rows in each group.

  • group_rows() returns the rows which each group contains.

  • group_indices() returns an integer vector the same length as .data that gives the group that each row belongs to.

  • group_vars() gives names of grouping variables as character vector.

  • groups() gives the names as a list of symbols.

  • group_size() gives the size of each group.

  • n_groups() gives the total number of groups.

Usage

group_data(.data)

group_rows(.data)

group_indices(.data)

group_vars(x)

groups(x)

group_size(x)

n_groups(x)

Arguments

.data, x

A data.frame.

See Also

See context for equivalent functions that return values for the current group.

Examples

df <- data.frame(x = c(1,1,2,2))
group_vars(df)
group_rows(df)
group_data(df)

gf <- group_by(df, x)
group_vars(gf)
group_rows(gf)
group_data(gf)


poorman documentation built on Nov. 2, 2023, 5:27 p.m.