Skip to contents

Returns a one-line, human-readable summary describing a group of contributors (such as frequency, dominant activity type, experience level, and top interest tags). Data are taken from either a single edits table 'df', or from precomputed tables ('contribs_tbl', 'edits_tbl', 'tags_tbl')

Usage

caption_group(
  df = NULL,
  contribs_tbl = NULL,
  edits_tbl = NULL,
  tags_tbl = NULL,
  max_names = 3L
)

Arguments

df

a data frame of edits with columns such as 'user', 'date', 'action' and either 'key' or 'tag'. If provided, this takes precedence over 'edits_tbl'

contribs_tbl

an optional data frame with contribution summaries per user, such as 'changesets', 'first_edit', 'last_edit', 'adds', 'mods', 'dels', 'total_edits'. e.g.

edits_tbl

an optional raw edits table used when 'df' is not supplied. Should contain 'user', 'date', 'action', 'key', 'tag'..

tags_tbl

an optional tags summary with columns 'key' and 'n' (counts)

max_names

maximum number of names to include in the caption #'

Value

a length-1 character vector containing the caption.

Examples

# Minimal example with a single edits table:
df <- tibble::tibble(
  user   = c("u1","u1","u2","u2","u3"),
  date   = as.Date(c("2024-01-01","2024-01-02","2024-01-01","2024-01-03","2024-01-03")),
  action = c("add","modify","add","delete","add"),
  key    = c("building","highway","building","landuse","highway")
)
caption_group(df = df)
#> [1] "This is a diverse group of frequent creators, mostly hobbyists, with interests in building, highway, landuse."