An open API service indexing awesome lists of open source software.

https://github.com/christopherkenny/planscorer


https://github.com/christopherkenny/planscorer

Last synced: 10 days ago
JSON representation

Awesome Lists containing this project

README

          

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = '#>',
fig.path = 'man/figures/README-',
out.width = '100%'
)
```

# planscorer

[![R-CMD-check](https://github.com/christopherkenny/planscorer/workflows/R-CMD-check/badge.svg)](https://github.com/christopherkenny/planscorer/actions)
[![planscorer status badge](https://christopherkenny.r-universe.dev/badges/planscorer)](https://christopherkenny.r-universe.dev/planscorer)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN status](https://www.r-pkg.org/badges/version/planscorer)](https://CRAN.R-project.org/package=planscorer)
![CRAN downloads](http://cranlogs.r-pkg.org/badges/grand-total/planscorer)

`planscorer` offers an R interface to PlanScore.org's API.

## Installation

You can install the stable version of planscorer from CRAN with:

``` r
install.packages('planscorer')
```

You can install the development version of planscorer from [GitHub](https://github.com/) with:

``` r
# install.packages('remotes')
remotes::install_github('christopherkenny/planscorer')
```

## Authentication

To use planscorer, you must have an API key from PlanScore. Otherwise, you will get a 403 forbidden error.

To get a key, follow the [instructions here](https://github.com/PlanScore/PlanScore/blob/main/API.md).

Once you have a key, use `ps_set_key('your_key')`. Optionally use `ps_set_key('your_key', install = TRUE)` to allow your key to be available across sessions.

## Example

With a file, you can upload using the `ps_upload_file()` option:

```{r example}
library(planscorer)
## basic example code

file <- system.file('extdata/null-plan-incumbency.geojson', package = 'planscorer')
links <- ps_upload_file(file)
```

```{r, echo=FALSE}
Sys.sleep(20)
```

To read the data results:

```{r}
ps_ingest(links)
```

To capture the outputted figures on the site:

```{r}
img <- 'man/figures/README-planscore.png'
ps_capture(links, img)

knitr::include_graphics(img)
```