fivethirtyeight (version 0.4.0)

senators: Senator Dataset

Description

Senator Dataset

Usage

senators

Arguments

Format

Because of R package size restrictions, only a preview of the first 10 rows of this dataset is included; to obtain the entire dataset see Examples below. A data frame with 10 rows representing tweets and 10 variables:

created_at

The date and time the tweet was posted

user

The user posting the tweet

text

The text of the tweet

url

The link to the tweet

replies

The number of replies to the tweet

retweets

The number of retweets

favorites

The number of favorites

bioguide_id

The poster's member ID from the "Biographical Directory of the United States Congress"

party

The poster's political party affiliation

state

The state the poster represents in Congress

Details

Data collected on Oct 19 and 20

See Also

twitter_presidents

Examples

Run this code
# NOT RUN {
# To obtain the entire dataset, run the code inside the following if statement:
if(FALSE){
  library(tidyverse)
  url <- "https://raw.githubusercontent.com/fivethirtyeight/data/master/twitter-ratio/senators.csv"
  senators <- read_csv(url) %>%
    mutate(
      party = as.factor(party),
      state = as.factor(state),
      created_at = as.POSIXct(created_at, tz = "GMT", format = "%m/%d/%Y %H:%M"),
      text =  gsub("[^\x01-\x7F]", "", text)
    ) %>%
    select(created_at, user, everything())
}
# }

Run the code above in your browser using DataLab