knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of pushshiftR is to make it easy to query the Push Shift Reddit comment search API.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("BelangerAnalytics/pushshiftR")
This is a basic example which shows you how to do a basic query:
library(pushshiftR) # query the PushShift API results <- pushshiftR::get_reddit_comments(q = '"quantum field theory"', size = 10, verbose = FALSE) # print the results (with some trimming/formatting to make a nice table) results %>% dplyr::select(author, subreddit, body, created_datetime ) %>% dplyr::mutate(body = stringr::str_trunc(body, width = 200)) %>% dplyr::mutate(body = stringr::str_replace_all(body, "\\n", " ")) %>% knitr::kable()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.