mkearney / rreddit

𝐫⟋ Get Reddit data
https://github.com/mkearney/rreddit
Other
50 stars 6 forks source link
mkearney-r-package pushshift r r-package reddit reddit-api rstats social-media web-scraping

rreddit

Build
status CRAN
status Coverage
Status

lifecycle

A package for getting lots of Reddit data.

Installation

Install the development version from Github with:

## install remotes pkg if not already
if (!requireNamespace("remotes")) {
  install.packages("remotes")
}

## install from github
remotes::install_github("mkearney/rreddit")

Use

An example of posts collected from the r/dataisbeautiful subreddit

## get up to 100,000 of the most recent posts made to /r/dataisbeautiful
d <- get_r_reddit("dataisbeautiful", n = 100000)

## aggregate by month and plot the time series
rtweet::ts_plot(dplyr::select(d, created_at = created_utc), "months", trim = 1) +
  tfse::theme_mwk(base_size = 12) +
  ggplot2::ylim(0, NA) +
  ggplot2::labs(
    x = NULL,
    y = NULL,
    title = "Activity on `r/dataisbeautiful` subreddit",
    subtitle = "Monthly number of submissions on r/dataisbeautiful"
  )