ts_data: Converts tweets data into time series-like data object.

Description Usage Arguments Value Examples

View source: R/ts_plot.R

Description

Returns data containing the frequency of tweets over a specified interval of time.

Usage

1
ts_data(data, by = "days", trim = 0L, tz = "UTC")

Arguments

data

Data frame or grouped data frame.

by

Desired interval of time expressed as numeral plus one of "secs", "mins", "hours", "days", "weeks", "months", or "years". If a numeric is provided, the value is assumed to be in seconds.

trim

Number of observations to trim off the front and end of each time series

tz

Time zone to be used, defaults to "UTC" (Twitter default)

Value

Data frame with time, n, and grouping column if applicable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 

## handles of women senators
sens <- c("SenatorBaldwin", "SenGillibrand", "PattyMurray", "SenatorHeitkamp")

## get timelines for each
sens <- get_timeline(sens, n = 3200)

## get single time series for tweets
ts_data(sens)

## using weekly intervals
ts_data(sens, "weeks")

## group by screen name and then use weekly intervals
ts_plot(dplyr::group_by(sens, screen_name), "weeks")

## End(Not run)

mkearney/rtweet documentation built on Sept. 29, 2021, 12:01 p.m.