Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jsta/externalrdata
Template for R packages that fetch, cache, and serve data from external sources
https://github.com/jsta/externalrdata
Last synced: about 1 month ago
JSON representation
Template for R packages that fetch, cache, and serve data from external sources
- Host: GitHub
- URL: https://github.com/jsta/externalrdata
- Owner: jsta
- Created: 2017-05-15T17:31:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T18:04:40.000Z (over 1 year ago)
- Last Synced: 2024-08-13T07:15:04.890Z (5 months ago)
- Language: R
- Homepage:
- Size: 26.4 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
Awesome Lists containing this project
- jimsghstars - jsta/externalrdata - Template for R packages that fetch, cache, and serve data from external sources (R)
README
---
output: github_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```## externalrdata
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![Travis-CI Build Status](https://travis-ci.org/jsta/externalrdata.svg?branch=master)](https://travis-ci.org/jsta/externalrdata)
This package is a template R package to fetch, cache, and serve data from external sources. All data sources are assumed to be `csv` files. The typical workflow would be to fork this package and rename the project-specific pieces including:
* `temp_get`
* _baseurl_
* _files_
* `cache_path`
* _appname_
* _appauthor_
* function prefixes (e.g. change `temp_get` to `myspecificproject_get`)## Installation
```{r eval=FALSE}
# install devtools if not found
# install.packages(devtools)
devtools::install_github("jsta/externalrdata")
```## Usage
```{r }
library(externalrdata)
```### Download external data and store in file system
```{r message=FALSE, eval=FALSE}
# for demonstration purposes we will set on-the-fly compilation to FALSE
temp_get(version_id = "1", compile = FALSE)
```### List files
```{r }
temp_ls(version_id = "1")
```### Compile version
```{r }
# these files have metadata headers that need to be skipped
temp_compile(version_id = "1", skip = c(16, 38))
```### List versions
```{r }
temp_versions()
```### Load data
```{r }
dt <- temp_load(version_id = "1")
names(dt)
lapply(dt, head)
```## Examples
### Uses this template
* https://github.com/jsta/nesRdata
* https://github.com/jsta/nsws### Uses as similar strategy
* https://github.com/jsta/nhdR
## Contributing
Contributions welcome in the form of issues and pull requests.