knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of hackr is to wrap the Hacker News API in R.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("tylurp/hackr")
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.