labelGroup: Renames groups extending accross multiple columns do that...

View source: R/dbplyHelper.R

labelGroupR Documentation

Renames groups extending accross multiple columns do that subgroups have sequentail id

Description

Sometime simpler to rename multiple grouping columns as one single column which encodes all the possible combinations.

Usage

labelGroup(
  df,
  groupVars,
  outputVar,
  summarise = FALSE,
  consistentBetweenGroups = FALSE
)

Arguments

df

- a df which may be grouped in which case the grouping can be interpreted as a feature and each group must have the same number in it.

groupVars

- the columns(s) for which we want to create a label - as a list of columns quoted by vars(...).

outputVar

- the name of the target column for the new discrete variable (or sample identifier)

summarise

- return dataframe as-is with additional column (FALSE - the default) or return dataframe as group summary with only grouping info and output (TRUE)

consistentBetweenGroups

- if the groups represent discrete variables that vary between groups then they are not comparable.

Value

a dbplyr dataframe containing the grouped function


terminological/tidy-info-stats documentation built on Nov. 19, 2022, 11:23 p.m.