| team_roster | R Documentation |
team_roster() adds a team (or repo) name column to a roster data frame by
randomly grouping members into teams of a target size. Teams may be formed
within groups (e.g. lab sections) via by, and names are built from a
glue template that can reference any column of roster
together with the generated team_id. When by is supplied and no name is
given, the grouping column(s) are folded into the default name so team names
stay unique across groups.
team_roster(
roster,
size,
name = NULL,
by = NULL,
col = "team",
pad = TRUE,
shuffle = TRUE,
seed = NULL
)
roster |
Data frame. Course roster with one row per student. |
size |
Integer. Target (maximum) team size. Within each group members are
split into |
name |
Character. A glue template for the team / repo name, used as-is if
supplied. May reference any column of |
by |
Character. Optional column name(s) in |
col |
Character. Name of the output column to add. Default |
pad |
Logical or integer. Zero-padding applied to |
shuffle |
Logical. Should members be randomly assigned to teams? Default |
seed |
Integer. Optional random seed for reproducible assignments. |
The roster data frame with team_id and col columns added.
## Not run:
roster = readr::read_csv(system.file("roster.csv", package = "ghclass"))
# Teams of 4 across the whole roster -> "team01", "team02", ...
team_roster(roster, size = 4)
# Teams of 4 within each lab section, group folded into the default name
team_roster(roster, size = 4, by = "section", seed = 20250901)
# Custom name template (used exactly as written)
team_roster(
roster, size = 4, by = "section",
name = "hw1_lab{section}_team{team_id}", seed = 20250901
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.