topics_metric: Gets the Topics for a given filter

Description Usage Arguments Details Value Finding topic tree IDs Examples

Description

Returns topic data for a given filter. The filter must filter on the brand's topic_tree.

Usage

1
2
3
topics_metric(code, filter, file = NULL, save = FALSE,
  truncateAt = NULL, showParents = TRUE, showChildren = TRUE,
  forParent = NULL)

Arguments

code

An account code

filter

A filter for data

file

An optional file name to save a CSV file to.

save

Set to TRUE if you'd like a dialog file to choose where to save your CSV.

truncateAt

Optional number of results - rest will become "Others". This takes the top topics based on the volume of mentions from the site.

showParents

Set this to FALSE if you don't want any parent topics included in the results.

showChildren

Set this to FALSE if you don't want any child topics included in the results.

forParent

An ID of a parent topic that you want data specifically for. Adds an extra column of percentage values specifically against that parent.

Details

One thing to note is that your filter should contain a topic tree id. This is a tag ID that identifies the topics assigned to a particular brand. See below for more details. Using the showParents and showChildren parameters, its easy to only show parent and child topics, respectively. It is also possible to show only a single parent and its children. See the forParent parameter. Essentially, you should pass it the ID of the parent topic whose children you are interested in.

Value

A tibble of your data

Finding topic tree IDs

The major difficulty in using this function is that your filter must contain a topic tree id. This is a tag ID that identifies the topics that have been assigned to the brand(s) that you're querying.

There are two ways to find the ID, both using brandseyer2. The first is to ask for all root brand information, like so:

1
2
3
library(brandseyer2)
account("BEUB03AA") %>%
  root_brands(short = FALSE)

The column topic_tree_id will give the topic tree ID for the brand that you are interested in.

Another way is to ask for the topic trees in an account:

1
2
3
library(brandseyer2)
account("BEUB03AA") %>%
  topic_trees()

This returns regular tag information (since topic trees are only tags).

Assuming the topic tree that you're interested in has an ID of 1001, and your filter is "published inthelast month and relevancy isnt irrelevant", your new filter should be "(published inthelast month and relevancy isnt irrelevant) and tag is 1001".

Examples

1
2
3
4
## Not run: 
topics_metric("QUIR01BA", "published inthelast week and brand isorchildof 10006 and tag is 1001")

## End(Not run)

brandseye/chartingtest documentation built on May 15, 2019, 3:17 p.m.