Some outputs of the get_ and parse_ functions contain list-columns (e.g. the labels column in the issues dataframe). This is an efficient way to represent the provided information, but may make certain information seem slightly inaccessible. This function allows users to "pivot" these list columns and instead create a seperate indicator variable to represent the presence or absence of matches within the list column.

listcol_pivot(
  data,
  col_name,
  regex = ".",
  transform_fx = identity,
  delete_orig = FALSE
)

Arguments

data

Dataframe containing a list column (e.g. an issues dataframe)

col_name

Character string containing column name of list column (e.g. labels_name or assignees_login)

regex

Character string of regular expression to identify list items of interest (e.g. "^priority:", "^(bug|feature)$")

transform_fx

Function to transform label name before converting to column (e.g. sub(":", "_"))

delete_orig

Logical denoting whether or not to delete original list column provided by col_name

Value

Dataframe additional logical columns denoting absence / presence of specified list-column elements

Details

For example, if a repository tags issues with "priority:high", "priority:medium", and "priority:low" along with other labels, this function could be used to create separate "high", "medium", and "low" columns to denote different issue severities. This could be done with listcol_pivot(data, "labels_name", "^priority:", function(x) sub("^priority:", ""))

Examples

if (FALSE) { issues <- get_issues(repo) issues_df <- parse_issues(issues) listcol_pivot(issues_df, col_name = "labels_name", regex = "^priority:", transform_fx = function(x) paste0("label_",x), delete_orig = TRUE) }