account_count: Counting mentions, authors, etc

Description Usage Arguments Details Methods (by class) Grouping Counting Including extra data API documentation Author(s) See Also Examples

Description

account_count is used to count mentions in a BrandsEye account matching matching a particular filter, and to produce aggreagate data related to them. It's possible to group mentions, order the results, and to include various other bits of useful information. It's also possible to perform count operations across multiple accounts, or to count things other than the number of mentions received, such as the number of unique authors, sites, and so on.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
account_count(account, ...)

## S3 method for class 'character'
account_count(accounts, filter = NULL, groupby = NULL,
  include = NULL, count = NULL,
  authentication = pkg.env$defaultAuthentication,
  showProgress = length(accounts) > 10, .process = TRUE)

## S3 method for class 'brandseye.account'
account_count(account, filter = NULL,
  groupby = NULL, include = NULL)

## S3 method for class 'factor'
account_count(account, ...)

Arguments

account

An account to be queried.

accounts

A vector of account codes. If this is a single account code, this function will return a data frame of results just from that account. If it contains multiple accounts, this will return a data frame containing all the results across accounts, and a column indicating the account that the particular result is from.

filter

A filter string describing the mentions that should be counted by this query.

groupby

A vector of items that should be grouped by. For example, c("published", "language"). See below for more information.

include

A vector of items naming values that should be included. For example, c("ots", "ave")

count

A vector items that should be counted instead of mentions themselves. By default, account_count will count mentions (equivalent to passing a value of "id" to count), but various other items may be counted instead, such as unique authors. See below for more information.

showProgress

Set to true if you would like a progress bar to be shown when querying multiple accounts.

.process

Indicates whether the types should be cleaned. For instance, date values transformed from strings to POSIXct objects, NA values properly handled, etc.

Details

Filters are described in the api documentation https://api.brandseye.com/docs

It's possible to parallelise this call. This is only useful if you're querying multiple accounts: there will be no benefit when querying only a single account. Any parallel backend for the foreach package can be used to enable parallel functioning. For example, on a Linux or OX X based system, the following will work well:

library(doMC) registerDoMC(8) account_count(list_account_codes(), "published inthelast day")

Methods (by class)

Grouping

The account_count function will by default return only a count of the mentions matching the given filter. If you would like more information, you should group by particular values. The following (possibly incomplete) list of fields can be grouped by:

action, alexaRank, assignee, author, authorName, brand, city, country, credibility, extract, feed, gender, language, link, linked, media, pageRank, phrase, phraseMatches, pickedUp, process, published, region, relevancy, relevancyVerified, sentiment, sentimentVerified, tag, title, updated, uri, replycount, resharecount, responsetime

Counting

account_count will by default count the number of mentions matching the filter (or the group that the mentions are being grouped by). It is also possible to count other items. These include:

id (the default), credibility, media, action, site, authorName, language, country, region, city, assignee, author, gender

Including extra data

Grouping is the first step to include extra data. However, some data cannot be grouped by, and are instead extra information added on to each of the returned buckets. This might include information as simple as a new format for the country code (countryISO3 being an example), or aggregate data for the group (AVE and OTS being examples).

An incomplete list of data that can be included are:

ave, ots, percentages, engagement, sentiment-reach, sentiment-count, countryISO3, latlon, scale, yaw, pitch, roll

API documentation

The canonical documentation for the filter language, and what fields may be grouped and included, is the BrandsEye API documentation https://api.brandseye.com/docs.

Author(s)

Constance Neeser

See Also

account for information on querying account information, including seeing the brands and phrases associated with an account.

account_mentions for querying raw mention data.

sentiment for comparing sentiment values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## Not run: 
account_count("QUIR01BA", "published inthelast month") # Uses default authentication, 
                                                 # if that has been set up.
account_count("QUIR01BA", "published inthelast month", 
        authentication = authentication(key = "<my key>"))
# Return results for multiple accounts      
account_count(c("QUIR01BA", "BEAD33AA"), "published inthelast month")      

# Return results for all accounts
account_count(list_account_codes(), "published inthelast month") 

# Return results grouped by publication date
account_count("QUIR01BA", "published inthelast month", groupby = "published)

# Include Ad Value Equivalent (AVE) and Opportunity to See
account_count("QUIR01BA", "published inthelast month", groupby = "published, 
        include = c("ave", "ots"))
        
# Count the number of unique authors
account_count("QUIR01BA", "published inthelast month", count="author")

# Count the number of unique authors in each country that we have received 
# mentions from
account_count("QUIR01BA", "published inthelast month", count="author", groupby="country")

## End(Not run)  
## Not run: 
# Not using global authentication, but authenticating directly in the call
# itself.
ac <- account("QUIR01BA", key="<my key>")

# A single number counting the mentions published in the last week. 
account_count(ac, "published inthelast week")

# The number of relevant mentions published in the last month
account_count(ac, "published inthelast month and relevancy isnt irrelevant")

# As above, but grouped by publication day
account_count(ac, "published inthelast month and relevancy isnt irrelevant", 
        groupby="published")

## End(Not run)

brandseye/brandseyer documentation built on May 13, 2019, 2:30 a.m.