4.6 KiB
opensensmapr
This R package ingests data from the API of opensensemap.org for analysis in R.
Features include:
osem_boxes()
: fetch sensor station ("box") metadata, with various filtersosem_measurements()
: fetch measurements by phenomenon, with various filters such as submitting spatial extent, time range, sensor type, box, exposure..- no time frame limitation through request paging!
- many helper functions to help understand the queried data
- caching queries for reproducibility
The package aims to be compatible with the tidyverse
and sf
,
so it is easy to analyze or vizualize the data with state of the art packages.
Usage
Complete documentation is provided via the R help system:
Each function's documentation can be viewed with ?<function-name>
.
A comprehensive overview of all functions is given in ?opensensmapr
.
There are also vignettes showcasing applications of this package:
- Visualising the History of openSenseMap.org: Showcase of
opensensmapr
withdplyr
+ggplot2
- Exploring the openSenseMap dataset: Showcase of included helper functions
- Caching openSenseMap Data for reproducibility
If you used this package for an analysis and think it could serve as a good example or showcase, feel free to add a vignette to the package via a PR!
Installation
The package is available on CRAN, install it via
install.packages('opensensmapr')
To install the very latest versions from GitHub, run:
install.packages('devtools')
devtools::install_github('sensebox/opensensmapr@master') # latest stable version
devtools::install_github('sensebox/opensensmapr@development') # bleeding edge version
Changelog
This project adheres to semantic versioning, for changes in recent versions please consult NEWS.md.
Contributing & Development
Contributions are very welcome!
When submitting a patch, please follow the existing code stlye,
and run R CMD check --no-vignettes .
on the package.
Where feasible, also add tests for the added / changed functionality in tests/testthat
.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
development environment
To set up the development environment for testing and checking, all suggested packages should be installed. On linux, these require some system dependencies:
# install dependencies for sf (see https://github.com/r-spatial/sf#installing)
sudo dnf install gdal-devel proj-devel proj-epsg proj-nad geos-devel udunits2-devel
# install suggested packages
R -e "install.packages(c('maps', 'maptools', 'tibble', 'rgeos', 'sf',
'knitr', 'rmarkdown', 'lubridate', 'units', 'jsonlite', 'ggplot2',
'zoo', 'lintr', 'testthat', 'covr')"
build
To build the package, either use devtools::build()
or run
R CMD build .
Next, run the tests and checks:
R CMD check --as-cran ../opensensmapr_*.tar.gz
# alternatively, if you're in a hurry:
R CMD check --no-vignettes ../opensensmapr_*.tar.gz
release
To create a release:
- make sure you are on master branch
- run the tests and checks as described above
- bump the version in
DESCRIPTION
- update
NEWS.md
- rebuild the documentation:
R -e 'devtools::document()'
- build the package again with the new version:
R CMD build . --no-build-vignettes
- tag the commit with the new version:
git tag v0.5.0
- push changes:
git push && git push --tags
- wait for all CI tests to complete successfully (helps in the next step)
- upload the new release to CRAN
- get back to the enjoyable parts of your life & hope you won't get bad mail next week.
License
GPL-2.0 - Norwin Roosen