Simple Collection and Powerful Analysis of Twitter Data

Overview

{tidytags} coordinates the simplicity of collecting tweets over time with a Twitter Archiving Google Sheet (TAGS) and the utility of the {rtweet} package for processing and preparing additional Twitter metadata. {tidytags} also introduces functions developed to facilitate systematic yet flexible analyses of data from Twitter.

Installation

You can install the development version of {tidytags} from GitHub:

install.packages("devtools")
devtools::install_github("bretsw/tidytags")

Soon, you will be able to install the released version of {tidytags} from CRAN with:

install.packages("tidytags")

Usage

To load {tidytags}, start with the library() function:

Setup

For help with initial {tidytags} setup, see the Getting started with tidytags vignette. Specifically, this guide offers help for four pain points:

  1. Making sure your TAGS tracker can be accessed
  2. Getting and storing a Google API key
  3. Getting and storing Twitter API tokens
  4. Getting and storing an OpenCage Geocoding API key

{tidytags} core functions

read_tags()

At its most basic level, {tidytags} allows you to import data from a Twitter Archiving Google Sheet (TAGS) into R. This is done with the {googlesheets4} package. One requirement for using the {googlesheets4} package is that your TAGS tracker has been “published to the web.” See the Getting started with tidytags vignette, Pain Point #1, if you need help with this.

Once a TAGS tracker has been published to the web, you can import the TAGS archive into R using read_tags(). See the Getting started with tidytags vignette, Pain Point #2, to set up API access to Google Sheets like the TAGS tracker.

pull_tweet_data()

With a TAGS archive imported into R, {tidytags} allows you to gather quite a bit more information related to the collected tweets with the pull_tweet_data() function. This function uses the {rtweet} package (via rtweet::lookup_statuses()) to query the Twitter API. This process requires Twitter API keys associated with an approved Twitter developer account. See the Getting started with tidytags vignette, Pain Point #3, if you need help with this.

Learning more about tidytags

For a walkthrough of numerous additional {tidytags} functions, see the Using tidytags with a conference hashtag vignette.

Getting help

{tidytags} is still a work in progress, so we fully expect that there are still some bugs to work out and functions to document better. If you find an issue, have a question, or think of something that you really wish {tidytags} would do for you, don’t hesitate to email Bret or reach out on Twitter: @bretsw and @jrosenberg6432.

You can also submit an issue on Github.

You may also wish too try some general troubleshooting strategies:

  • Try to find out what the specific problem is
    • Identify what is not causing the problem
  • “Unplug and plug it back in” - restart R, close and reopen R
  • Reach out to others! Sharing what is causing an issue can often help to clarify the problem.
  • General strategies on learning more: https://datascienceineducation.com/c17.html

Contributing

If you encounter an obvious bug for which there is not already an active issue, please create a new issue with all code used (preferably a reproducible example) on Github.

If you would like to become a more involved contributor, please read the Contributing Guide. All contributors, from those fixing typos to adding new functionality, must adhere to the Code of Conduct.

License license

The {tidytags} package is licensed under a GNU General Public License v3.0, or GPL-3. For background on why we chose this license, read this chapter on R package licensing.