mirror of
https://github.com/sensebox/opensensmapr
synced 2025-02-21 21:53:57 +01:00
hello CRAN :^|
i'm all in for quality control, but some of these checks are just ridiculous.. rejecting a package b/c of typos auto-checked against an aspell dict - in a text read by ~1% of users?? and the only workaround (whitelisting words) is not documented, and TOTALLY overengineered?!? going for the tech elitism awards, huh /rant but hey, we're on board of that train now! :}
This commit is contained in:
parent
a7462ba1e1
commit
4f95ae19a8
11 changed files with 91 additions and 73 deletions
4
.aspell/defaults.R
Normal file
4
.aspell/defaults.R
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Rd_files <- vignettes <- R_files <- description <-
|
||||||
|
list(encoding = "UTF-8",
|
||||||
|
language = "en",
|
||||||
|
dictionaries = c("en_stats", "opensensmapr"))
|
BIN
.aspell/opensensmapr.rds
Normal file
BIN
.aspell/opensensmapr.rds
Normal file
Binary file not shown.
11
DESCRIPTION
11
DESCRIPTION
|
@ -1,6 +1,6 @@
|
||||||
Package: opensensmapr
|
Package: opensensmapr
|
||||||
Type: Package
|
Type: Package
|
||||||
Title: Work with Sensor Data from Opensensemap.org in R
|
Title: Client for the data API of openSenseMap.org
|
||||||
Version: 0.3.3
|
Version: 0.3.3
|
||||||
URL: http://github.com/noerw/opensensmapR
|
URL: http://github.com/noerw/opensensmapR
|
||||||
BugReports: http://github.com/noerw/opensensmapR/issues
|
BugReports: http://github.com/noerw/opensensmapR/issues
|
||||||
|
@ -23,12 +23,13 @@ Suggests:
|
||||||
covr
|
covr
|
||||||
Authors@R: c(person("Norwin", "Roosen", role = c("aut", "cre"), email = "hello@nroo.de"),
|
Authors@R: c(person("Norwin", "Roosen", role = c("aut", "cre"), email = "hello@nroo.de"),
|
||||||
person("Daniel", "Nuest", role = c("ctb"), email = "daniel.nuest@uni-muenster.de", comment = c(ORCID = "0000-0003-2392-6140")))
|
person("Daniel", "Nuest", role = c("ctb"), email = "daniel.nuest@uni-muenster.de", comment = c(ORCID = "0000-0003-2392-6140")))
|
||||||
Description: Download data (environmental measurements, sensorstations) from the
|
Description: Download environmental measurements and sensor station metadata
|
||||||
API of open data sensor web platform 'opensensemap.org' for analysis in R.
|
from the API of open data sensor web platform <https://opensensemap.org> for
|
||||||
This platform provides realtime data of more than 1500 low-cost sensor
|
analysis in R.
|
||||||
|
This platform provides real time data of more than 1500 low-cost sensor
|
||||||
stations for PM10, PM2.5, temperature, humidity, UV-A intensity and more
|
stations for PM10, PM2.5, temperature, humidity, UV-A intensity and more
|
||||||
phenomena.
|
phenomena.
|
||||||
The package aims to be compatible with sf and the tidyverse, and provides
|
The package aims to be compatible with 'sf' and the 'Tidyverse', and provides
|
||||||
several helper functions for data exploration and transformation.
|
several helper functions for data exploration and transformation.
|
||||||
License: GPL (>= 2) | file LICENSE
|
License: GPL (>= 2) | file LICENSE
|
||||||
Encoding: UTF-8
|
Encoding: UTF-8
|
||||||
|
|
15
R/box.R
15
R/box.R
|
@ -27,15 +27,16 @@
|
||||||
#' @seealso \code{\link{osem_box}}
|
#' @seealso \code{\link{osem_box}}
|
||||||
#' @export
|
#' @export
|
||||||
#' @examples
|
#' @examples
|
||||||
#' # get *all* boxes available on the API
|
#' \donttest{
|
||||||
#' b = osem_boxes()
|
#' # get *all* boxes available on the API
|
||||||
|
#' b = osem_boxes()
|
||||||
#'
|
#'
|
||||||
#' # get all boxes with grouptag 'ifgi' that are placed outdoors
|
#' # get all boxes with grouptag 'ifgi' that are placed outdoors
|
||||||
#' b = osem_boxes(grouptag = 'ifgi', exposure = 'outdoor')
|
#' b = osem_boxes(grouptag = 'ifgi', exposure = 'outdoor')
|
||||||
#'
|
|
||||||
#' # get all boxes that have measured PM2.5 in the last 4 hours
|
|
||||||
#' b = osem_boxes(date = Sys.time(), phenomenon = 'PM2.5')
|
|
||||||
#'
|
#'
|
||||||
|
#' # get all boxes that have measured PM2.5 in the last 4 hours
|
||||||
|
#' b = osem_boxes(date = Sys.time(), phenomenon = 'PM2.5')
|
||||||
|
#' }
|
||||||
osem_boxes = function (exposure = NA, model = NA, grouptag = NA,
|
osem_boxes = function (exposure = NA, model = NA, grouptag = NA,
|
||||||
date = NA, from = NA, to = NA, phenomenon = NA,
|
date = NA, from = NA, to = NA, phenomenon = NA,
|
||||||
endpoint = osem_endpoint(),
|
endpoint = osem_endpoint(),
|
||||||
|
|
|
@ -35,9 +35,10 @@ osem_measurements = function (x, ...) UseMethod('osem_measurements')
|
||||||
#' @describeIn osem_measurements Get measurements from \strong{all} senseBoxes.
|
#' @describeIn osem_measurements Get measurements from \strong{all} senseBoxes.
|
||||||
#' @export
|
#' @export
|
||||||
#' @examples
|
#' @examples
|
||||||
#' # get measurements from all boxes
|
#' \donttest{
|
||||||
#' m1 = osem_measurements('Windrichtung')
|
#' # get measurements from all boxes
|
||||||
#'
|
#' m1 = osem_measurements('Windrichtung')
|
||||||
|
#' }
|
||||||
osem_measurements.default = function (x, ...) {
|
osem_measurements.default = function (x, ...) {
|
||||||
bbox = structure(c(-180, -90, 180, 90), class = 'bbox')
|
bbox = structure(c(-180, -90, 180, 90), class = 'bbox')
|
||||||
osem_measurements(bbox, x, ...)
|
osem_measurements(bbox, x, ...)
|
||||||
|
@ -48,14 +49,15 @@ osem_measurements.default = function (x, ...) {
|
||||||
#' @describeIn osem_measurements Get measurements by a spatial filter.
|
#' @describeIn osem_measurements Get measurements by a spatial filter.
|
||||||
#' @export
|
#' @export
|
||||||
#' @examples
|
#' @examples
|
||||||
#' # get measurements from sensors within a bounding box
|
#' \donttest{
|
||||||
#' bbox = structure(c(7, 51, 8, 52), class = 'bbox')
|
#' # get measurements from sensors within a bounding box
|
||||||
#' m2 = osem_measurements(bbox, 'Temperatur')
|
#' bbox = structure(c(7, 51, 8, 52), class = 'bbox')
|
||||||
#'
|
#' m2 = osem_measurements(bbox, 'Temperatur')
|
||||||
#' points = sf::st_multipoint(matrix(c(7.5, 7.8, 51.7, 52), 2, 2))
|
|
||||||
#' bbox2 = sf::st_bbox(points)
|
|
||||||
#' m3 = osem_measurements(bbox2, 'Temperatur', exposure = 'outdoor')
|
|
||||||
#'
|
#'
|
||||||
|
#' points = sf::st_multipoint(matrix(c(7.5, 7.8, 51.7, 52), 2, 2))
|
||||||
|
#' bbox2 = sf::st_bbox(points)
|
||||||
|
#' m3 = osem_measurements(bbox2, 'Temperatur', exposure = 'outdoor')
|
||||||
|
#' }
|
||||||
osem_measurements.bbox = function (x, phenomenon, exposure = NA,
|
osem_measurements.bbox = function (x, phenomenon, exposure = NA,
|
||||||
from = NA, to = NA, columns = NA,
|
from = NA, to = NA, columns = NA,
|
||||||
...,
|
...,
|
||||||
|
@ -73,14 +75,15 @@ osem_measurements.bbox = function (x, phenomenon, exposure = NA,
|
||||||
#' @describeIn osem_measurements Get measurements from a set of senseBoxes.
|
#' @describeIn osem_measurements Get measurements from a set of senseBoxes.
|
||||||
#' @export
|
#' @export
|
||||||
#' @examples
|
#' @examples
|
||||||
#' # get measurements from a set of boxes
|
#' \donttest{
|
||||||
#' b = osem_boxes(grouptag = 'ifgi')
|
#' # get measurements from a set of boxes
|
||||||
#' m4 = osem_measurements(b, phenomenon = 'Temperatur')
|
#' b = osem_boxes(grouptag = 'ifgi')
|
||||||
#'
|
#' m4 = osem_measurements(b, phenomenon = 'Temperatur')
|
||||||
#' # ...or a single box
|
|
||||||
#' b = osem_box('57000b8745fd40c8196ad04c')
|
|
||||||
#' m5 = osem_measurements(b, phenomenon = 'Temperatur')
|
|
||||||
#'
|
#'
|
||||||
|
#' # ...or a single box
|
||||||
|
#' b = osem_box('57000b8745fd40c8196ad04c')
|
||||||
|
#' m5 = osem_measurements(b, phenomenon = 'Temperatur')
|
||||||
|
#' }
|
||||||
osem_measurements.sensebox = function (x, phenomenon, exposure = NA,
|
osem_measurements.sensebox = function (x, phenomenon, exposure = NA,
|
||||||
from = NA, to = NA, columns = NA,
|
from = NA, to = NA, columns = NA,
|
||||||
...,
|
...,
|
||||||
|
|
|
@ -24,9 +24,10 @@ osem_phenomena = function (boxes) UseMethod('osem_phenomena')
|
||||||
#' )
|
#' )
|
||||||
#'
|
#'
|
||||||
#' # get phenomena with at least 30 sensors on opensensemap
|
#' # get phenomena with at least 30 sensors on opensensemap
|
||||||
#' phenoms = osem_phenomena(osem_boxes())
|
#' \donttest{
|
||||||
#' names(phenoms[phenoms > 29])
|
#' phenoms = osem_phenomena(osem_boxes())
|
||||||
#'
|
#' names(phenoms[phenoms > 29])
|
||||||
|
#' }
|
||||||
osem_phenomena.sensebox = function (boxes) {
|
osem_phenomena.sensebox = function (boxes) {
|
||||||
p = Reduce(`c`, boxes$phenomena) %>% # get all the row contents in a single vector
|
p = Reduce(`c`, boxes$phenomena) %>% # get all the row contents in a single vector
|
||||||
table() %>% # get count for each phenomenon
|
table() %>% # get count for each phenomenon
|
||||||
|
|
29
README.md
29
README.md
|
@ -7,18 +7,26 @@ The package aims to be compatible with sf and the tidyverse.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
Right now, the package is not on CRAN. To install it from GitHub, run:
|
The package is available on CRAN, install it via
|
||||||
|
|
||||||
|
```r
|
||||||
|
install.packages('opensensmapr')
|
||||||
|
```
|
||||||
|
|
||||||
|
To install the veryy latest from GitHub, run:
|
||||||
|
|
||||||
```r
|
```r
|
||||||
install.packages('devtools')
|
install.packages('devtools')
|
||||||
devtools::install_github('noerw/opensensmapr')
|
devtools::install_github('noerw/opensensmapr@master') # latest stable version
|
||||||
|
devtools::install_github('noerw/opensensmapr@development') # bleeding edge version
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
A verbose usage example is shown in the vignette [`osem-intro`](https://noerw.github.com/opensensmapR/inst/doc/osem-intro.html).
|
Each function's documentation can be viewed with `?<function-name>`.
|
||||||
Each functions documentation can be viewed with `?<function-name>`.
|
|
||||||
An overview is given in `?opensensmapr`.
|
An overview is given in `?opensensmapr`.
|
||||||
|
A verbose usage example is shown in the vignette [`osem-intro`](https://noerw.github.com/opensensmapR/inst/doc/osem-intro.html).
|
||||||
|
|
||||||
In short, the following pseudocode shows the main functions for data retrieval:
|
In short, the following pseudocode shows the main functions for data retrieval:
|
||||||
|
|
||||||
```r
|
```r
|
||||||
|
@ -46,16 +54,11 @@ Additionally there are some helpers: `summary.sensebox(), plot.sensebox(), st_as
|
||||||
|
|
||||||
This project adheres to semantic versioning, for changes in recent versions please consult [CHANGES.md](CHANGES.md).
|
This project adheres to semantic versioning, for changes in recent versions please consult [CHANGES.md](CHANGES.md).
|
||||||
|
|
||||||
## FAQ
|
## Contributing & Development
|
||||||
|
|
||||||
- *Whats up with that package name?* idk, the R people seem to [enjoy][1] [dropping][2] [vovels][3] so..
|
Contributions are very welcome!
|
||||||
Unfortunately I couldn't fit the naming convention to drop an `y` in there.
|
When submitting a patch, please follow the existing [code style](.lintr),
|
||||||
|
and run `R CMD check --no-vignettes .` on the package.
|
||||||
[1]: https://github.com/tidyverse/readr
|
|
||||||
[2]: https://github.com/tidyverse/dplyr
|
|
||||||
[3]: https://github.com/tidyverse/tidyr
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
|
Please note that this project is released with a [Contributor Code of Conduct](CONDUCT.md).
|
||||||
By participating in this project you agree to abide by its terms.
|
By participating in this project you agree to abide by its terms.
|
||||||
|
|
|
@ -92,7 +92,7 @@ openSenseMap API: \url{https://api.opensensemap.org/}
|
||||||
official openSenseMap API documentation: \url{https://docs.opensensemap.org/}
|
official openSenseMap API documentation: \url{https://docs.opensensemap.org/}
|
||||||
}
|
}
|
||||||
\author{
|
\author{
|
||||||
\strong{Maintainer}: Norwin Roosen \email{bugs@nroo.de}
|
\strong{Maintainer}: Norwin Roosen \email{hello@nroo.de}
|
||||||
|
|
||||||
Other contributors:
|
Other contributors:
|
||||||
\itemize{
|
\itemize{
|
||||||
|
|
|
@ -41,15 +41,16 @@ Note that some filters do not work together:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
\examples{
|
\examples{
|
||||||
# get *all* boxes available on the API
|
\donttest{
|
||||||
b = osem_boxes()
|
# get *all* boxes available on the API
|
||||||
|
b = osem_boxes()
|
||||||
|
|
||||||
# get all boxes with grouptag 'ifgi' that are placed outdoors
|
# get all boxes with grouptag 'ifgi' that are placed outdoors
|
||||||
b = osem_boxes(grouptag = 'ifgi', exposure = 'outdoor')
|
b = osem_boxes(grouptag = 'ifgi', exposure = 'outdoor')
|
||||||
|
|
||||||
# get all boxes that have measured PM2.5 in the last 4 hours
|
|
||||||
b = osem_boxes(date = Sys.time(), phenomenon = 'PM2.5')
|
|
||||||
|
|
||||||
|
# get all boxes that have measured PM2.5 in the last 4 hours
|
||||||
|
b = osem_boxes(date = Sys.time(), phenomenon = 'PM2.5')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
\seealso{
|
\seealso{
|
||||||
\href{https://docs.opensensemap.org/#api-Measurements-findAllBoxes}{openSenseMap API documentation (web)}
|
\href{https://docs.opensensemap.org/#api-Measurements-findAllBoxes}{openSenseMap API documentation (web)}
|
||||||
|
|
|
@ -62,25 +62,28 @@ a bounding box spanning the whole world.
|
||||||
}}
|
}}
|
||||||
|
|
||||||
\examples{
|
\examples{
|
||||||
# get measurements from all boxes
|
\donttest{
|
||||||
m1 = osem_measurements('Windrichtung')
|
# get measurements from all boxes
|
||||||
|
m1 = osem_measurements('Windrichtung')
|
||||||
|
}
|
||||||
|
\donttest{
|
||||||
|
# get measurements from sensors within a bounding box
|
||||||
|
bbox = structure(c(7, 51, 8, 52), class = 'bbox')
|
||||||
|
m2 = osem_measurements(bbox, 'Temperatur')
|
||||||
|
|
||||||
# get measurements from sensors within a bounding box
|
points = sf::st_multipoint(matrix(c(7.5, 7.8, 51.7, 52), 2, 2))
|
||||||
bbox = structure(c(7, 51, 8, 52), class = 'bbox')
|
bbox2 = sf::st_bbox(points)
|
||||||
m2 = osem_measurements(bbox, 'Temperatur')
|
m3 = osem_measurements(bbox2, 'Temperatur', exposure = 'outdoor')
|
||||||
|
}
|
||||||
points = sf::st_multipoint(matrix(c(7.5, 7.8, 51.7, 52), 2, 2))
|
\donttest{
|
||||||
bbox2 = sf::st_bbox(points)
|
# get measurements from a set of boxes
|
||||||
m3 = osem_measurements(bbox2, 'Temperatur', exposure = 'outdoor')
|
b = osem_boxes(grouptag = 'ifgi')
|
||||||
|
m4 = osem_measurements(b, phenomenon = 'Temperatur')
|
||||||
# get measurements from a set of boxes
|
|
||||||
b = osem_boxes(grouptag = 'ifgi')
|
|
||||||
m4 = osem_measurements(b, phenomenon = 'Temperatur')
|
|
||||||
|
|
||||||
# ...or a single box
|
|
||||||
b = osem_box('57000b8745fd40c8196ad04c')
|
|
||||||
m5 = osem_measurements(b, phenomenon = 'Temperatur')
|
|
||||||
|
|
||||||
|
# ...or a single box
|
||||||
|
b = osem_box('57000b8745fd40c8196ad04c')
|
||||||
|
m5 = osem_measurements(b, phenomenon = 'Temperatur')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
\seealso{
|
\seealso{
|
||||||
\href{https://docs.opensensemap.org/#api-Measurements-getDataMulti}{openSenseMap API documentation (web)}
|
\href{https://docs.opensensemap.org/#api-Measurements-getDataMulti}{openSenseMap API documentation (web)}
|
||||||
|
|
|
@ -35,9 +35,10 @@ osem_phenomena(
|
||||||
)
|
)
|
||||||
|
|
||||||
# get phenomena with at least 30 sensors on opensensemap
|
# get phenomena with at least 30 sensors on opensensemap
|
||||||
phenoms = osem_phenomena(osem_boxes())
|
\donttest{
|
||||||
names(phenoms[phenoms > 29])
|
phenoms = osem_phenomena(osem_boxes())
|
||||||
|
names(phenoms[phenoms > 29])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
\seealso{
|
\seealso{
|
||||||
\code{\link{osem_boxes}}
|
\code{\link{osem_boxes}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue