knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

hackr

Travis build status AppVeyor build status Codecov test coverage

The goal of hackr is to wrap the Hacker News API in R.

Installation

You can install the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("tylurp/hackr")

Example

You can fetch top stories, new stories, or best stories. By default, a tibble is returned, if there is a kids column (comments identifier), it will be nested in order to return a single row for each story. You can override this with unnest = TRUE and show comments with comments = TRUE:

library(hackr)
library(dplyr)

hackr_top_stories()
hackr_top_stories(n = 1, unnest = TRUE, comments = TRUE) %>% 
  select(title, comment)
hackr_new_stories(2)
hackr_best_stories(2)

That's it for now. Will add more features soon.



tyluRp/hackr documentation built on Nov. 5, 2019, 11:02 a.m.