Travis build status AppVeyor Build Status Coverage status

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

leanpubr Package:

The goal of leanpubr is to provide provides access to the 'Leanpub' 'API' https://leanpub.com/help/api for gathering information about publications and submissions to the 'Leanpub' platform.

Installation

You can install leanpubr from GitHub with:

# install.packages("remotes")
remotes::install_github("muschellij2/leanpubr")

Setting the API key

The main thing you need to do is get an API key from Leanpub. You can do this by visiting https://leanpub.com/author_dashboard/settings if you are an author. If you are not an author, I don't believe access to the API is possible. You can pass this api_key to functions in Leanpub (almost all prefixed by lp_), or you can set the environmental variable LEANPUB_API_KEY. You can set this in an interactive R session such as:

Sys.setenv("LEANPUB_API_KEY" = "YOUR_KEY")

or put this in your ~/.Renviron:

LEANPUB_API_KEY = "YOUR_KEY"

Example

You can use lp_book_info to get information about any book in Leanpub:

Sys.setenv("LEANPUB_API_KEY" = "asdf")
library(leanpubr)
slug = "biostatmethods"
res = lp_book_info(slug, error = FALSE, verbose = TRUE)
res$content


muschellij2/leanpubr documentation built on May 18, 2019, 8:10 p.m.