with_tag_parents: Determine the parent of tags given a particular tree

Description Usage Arguments Value Examples

View source: R/account_with_tag_parents.R

Description

Adds a column called parent to a table. This is the ID of a tag's parent tag. Since tags can have multiple parents, we need to know what the ultimate root parent to determine "parenthood" is. This is done using the parent_id parameter.

Usage

1
with_tag_parents(tags, parent_id)

Arguments

tags

A tibble of tags to find parents for

parent_id

A root parent that all children are determined from

Value

The same tags tibble, but annotated with a parent column

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Add parents to tags
account("TEST01AA") %>%
  tags() %>%
  with_tag_parents(10)

# See what root brands we have
account("TEST01AA") %>%
  topic_trees()

# Tag 1001 is a topic tree. Let's find
# topics, with parents, that are part of this tree.
account("TEST01AA") %>%
  tags() %>%
  with_tag_parents(1001) %>%
  dplyr::filter(namespace == 'topic') %>%
  dplyr::arrange(desc(is_parent), name)

brandseye/brandseyer2 documentation built on Sept. 5, 2021, 2:15 p.m.