https://github.com/christopherkenny/planscorer
https://github.com/christopherkenny/planscorer
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/christopherkenny/planscorer
- Owner: christopherkenny
- License: other
- Created: 2022-11-23T04:39:30.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-25T14:33:56.000Z (about 1 year ago)
- Last Synced: 2024-09-26T01:39:51.372Z (about 1 year ago)
- Language: R
- Homepage: http://christophertkenny.com/planscorer/
- Size: 6.23 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
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%'
)
```
[](https://github.com/christopherkenny/planscorer/actions)
[](https://christopherkenny.r-universe.dev/planscorer)
[](https://lifecycle.r-lib.org/articles/stages.html#stable)
[](https://CRAN.R-project.org/package=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)
```
