showGroups: Interactively print individual groups of a grouped data.frame

View source: R/showGroups.R

showGroupsR Documentation

Interactively print individual groups of a grouped data.frame

Description

Print first group of a grouped data.frame, then prompt user to either print the next group or quit. Group order is determined by dplyr::group_rows.

Usage

showGroups(df, i = 1, n = 1, max_rows = 50, interactive = TRUE)

Arguments

df

A *grouped* data.frame

i

(integer(1), default 1) Index of the group to be printed.

n

(integer(1), default 1) How many groups to show at once?

max_rows

integer(1) Maximum number of rows to print (Default: 50).

interactive

(default: TRUE) Should the function wait for a command prompt to show the next group?

Value

Prints a group (or n groups, if parameter n is set) of a grouped data.frame df. The group order is determined by dplyr. If interactive is TRUE, there is a console prompt to either print the next group or quit. If interactive is FALSE, a single group is printed, with the group index specified by parameter i.

Author(s)

Helen Lindsay

Examples

df <- data.frame(Col1 = rep(c("A", "B"), 2), Col2 = 1:4)
df <- dplyr::group_by(df, Col1)
# Print the second group.  Use interactive = TRUE to print each
# group interactively
showGroups(df, i = 2, interactive = FALSE)

HelenLindsay/AbNames documentation built on June 6, 2023, 1:18 p.m.