Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sellorm/rspmapi
R Wrapper Around The RStudio Package Manager API
https://github.com/sellorm/rspmapi
Last synced: about 1 month ago
JSON representation
R Wrapper Around The RStudio Package Manager API
- Host: GitHub
- URL: https://github.com/sellorm/rspmapi
- Owner: sellorm
- License: other
- Created: 2022-03-11T19:29:41.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-03-30T17:10:46.000Z (over 2 years ago)
- Last Synced: 2024-08-13T07:11:42.310Z (4 months ago)
- Language: R
- Size: 38.1 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - sellorm/rspmapi - R Wrapper Around The RStudio Package Manager API (R)
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# rspmapi
The `rspmapi` package implements an R wrapper around the RStudio Package Manager API.
## Installation
You can install the development version of `rspmapi` from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("sellorm/rspmapi")
```## Example
In order to use any of the supplied functions, you must first connect to your
Package Manager instance:```{r connection}
library(rspmapi)
rspm <- instance("https://packagemanager.rstudio.com")
```Once you have an RSPM instance object, you can use it to perform API operations.
Each API endpoint has a corresponding function in `rspmapi`.
```{r status}
result <- rspm %>%
status()
result$version
```Some of the functions take additional arguments:
```{r sources}
result <- rspm %>%
repos_sources(id = 1)
result[[1]]$created
```Some functions can optionally take additional query string parameters. These are
documented in the
[RSPM API docs](https://packagemanager.rstudio.com/__api__/swagger/index.html)
for each API call.```{r params}
params <- list(`_limit` = 5, `_page` = 2, name_like = "shiny")
result <- rspm %>%
sources_packages(id = 1, params = params)
unlist(lapply(result, function(x){x$name}))
```