An R library that provides access to the social media data stored in a BrandsEye account
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
man
vignettes
.Rbuildignore
.gitignore
DESCRIPTION
NAMESPACE
NEWS.md
README.Rmd
README.md

README.md

BrandsEyeR

BrandsEye is a company that provides online monitoring, analytics, and insights for social media data. We provide an extensive JSON / RESTful API to access to the data that makes up your various BrandsEye accounts. This library is a wrapper for that API, and makes it easy to access the data outside of the BrandsEye application in any R analyses that you might want to perform.

Installing

Installation is currently done via the devtools package:

# Install the devtools package
install.packages("devtools")
library(devtools)

# Install the library
install_github("brandseye/brandseyer")

# Load the library
library(brandseyer)

Examples of use

You can create an account object using:

library(brandseyer)
ac <- account("QUIR01BA", key = "<MY API KEY>")    

and then you can query it using account_count:

library(dplyr)
# Break down mention counts per country for the month of January, 2015.
filter <- "published after '2015/01/01' and published before '2015/02/01'"
countries <- account_count(ac, filter, groupby = "country") %>%
             # And here we sort by the count field using the dplyr package
             arrange(desc(count))

And here are the first few entries of the returned data frame:

countryName count country
Unknown 23534 NA
United States 12782 US
United Kingdom 3238 GB
Canada 1293 CA
India 950 IN
France 710 FR

The call to BrandsEye can be simplified to one line, and can also be done across all of the accounts that you have:

account_count(list_account_codes(), 
              "published after '2015/01/01' and published before '2015/02/01'",
              groupby = "country")

Authentication

You can automate this using the authenticate function:

?authenticate

Specifically, if you're happy having your credentials saved on your hard drive, you can do this:

authenticate(key = "<MY API KEY>", save = TRUE)

Please see the documentation for authenticate for some advice on securing that file.

Contact your client service representative to get your API key. If you are ever concerned that others may have acquired your key, contact client service and they'll supply you with a new one (and invalidate your old).

Documentation

All functions are documented within R itself. Interesting functions to read up on are:

  • account, to access account information.
  • list_account_codes, to see which accounts you have access to.
  • account_count, to pull aggregate data over mentions using the BrandsEye filter language.
  • account_mentions, to pull mention data.

The ultimate documentation for the filter language (the filter argument taken by many of the functions for selecting data sets) and the various grouping and inclusions options is the BrandsEye api documentation.

The following resources will be useful when using this library:

Both of the above require access to the BrandsEye app. If you don't already have access, you can contact your client service representative to create a login.

Recent changes

Recent changes are listed in the news file.

License

This project is licensed under the MIT license.

Copyright (c) 2015, Brandseye PTY (LTD)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.