listcol_filter {projmgr}R Documentation

Filter dataframe by list-column elements

Description

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 filter list columns by the presence of one or more values or a regular expression.

Usage

listcol_filter(data, col_name, matches, is_regex = 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)

matches

A character vector containing a regular expression or one or more exact-match values. An observation will be kept in the returned data if any of the

is_regex

Logical to indicate whether charalcter indicates a regular expression or specific values

Value

Dataframe containing only rows in which list-column contains element matching provided criteria

Examples

## Not run: 
issues <- get_issues(repo)
issues_df <- parse_issues(issues)

# keep observation containing a label of either "bug" or "feature"
listcol_filter(issues_df, col_name = "labels_name", matches = c("bug", "feature"))

# keep observation containing a label that starts with "region"
listcol_filter(issues_df, col_name = "labels_name", matches = "^region:", is_regex = TRUE)

## End(Not run)

[Package projmgr version 0.1.1 Index]