Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/christopherkenny/planscorer


https://github.com/christopherkenny/planscorer

Last synced: 28 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/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/christopherkenny/planscorer/actions/workflows/R-CMD-check.yaml)

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

## Installation

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)
```