From 4f95ae19a8dca27c624999cd517c26ebeeae94bd Mon Sep 17 00:00:00 2001 From: noerw Date: Mon, 7 May 2018 18:32:53 +0200 Subject: [PATCH] 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! :} --- .aspell/defaults.R | 4 ++++ .aspell/opensensmapr.rds | Bin 0 -> 77 bytes DESCRIPTION | 11 ++++++----- R/box.R | 15 +++++++------- R/measurement.R | 37 +++++++++++++++++++---------------- R/phenomena.R | 7 ++++--- README.md | 29 ++++++++++++++------------- man/opensensmapr.Rd | 2 +- man/osem_boxes.Rd | 15 +++++++------- man/osem_measurements.Rd | 41 +++++++++++++++++++++------------------ man/osem_phenomena.Rd | 7 ++++--- 11 files changed, 93 insertions(+), 75 deletions(-) create mode 100644 .aspell/defaults.R create mode 100644 .aspell/opensensmapr.rds diff --git a/.aspell/defaults.R b/.aspell/defaults.R new file mode 100644 index 0000000..87d9494 --- /dev/null +++ b/.aspell/defaults.R @@ -0,0 +1,4 @@ +Rd_files <- vignettes <- R_files <- description <- + list(encoding = "UTF-8", + language = "en", + dictionaries = c("en_stats", "opensensmapr")) diff --git a/.aspell/opensensmapr.rds b/.aspell/opensensmapr.rds new file mode 100644 index 0000000000000000000000000000000000000000..872cc0927b882959e9178060a167c7a2fcd2fdbe GIT binary patch literal 77 zcmb2|=3oE==I#ec2?+^F32BLm2}x{5k}M4~rZ%=V3VVG1A-?39Xmdbb5~Gife0zj} d#~E?GV~k;sr^GiN@;|knfg#SP{BIG^6adX)8wCIW literal 0 HcmV?d00001 diff --git a/DESCRIPTION b/DESCRIPTION index 46e60e1..10bc591 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: opensensmapr 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 URL: http://github.com/noerw/opensensmapR BugReports: http://github.com/noerw/opensensmapR/issues @@ -23,12 +23,13 @@ Suggests: covr 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"))) -Description: Download data (environmental measurements, sensorstations) from the - API of open data sensor web platform 'opensensemap.org' for analysis in R. - This platform provides realtime data of more than 1500 low-cost sensor +Description: Download environmental measurements and sensor station metadata + from the API of open data sensor web platform for + 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 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. License: GPL (>= 2) | file LICENSE Encoding: UTF-8 diff --git a/R/box.R b/R/box.R index 0637b39..26bf9f3 100644 --- a/R/box.R +++ b/R/box.R @@ -27,15 +27,16 @@ #' @seealso \code{\link{osem_box}} #' @export #' @examples -#' # get *all* boxes available on the API -#' b = osem_boxes() +#' \donttest{ +#' # get *all* boxes available on the API +#' b = osem_boxes() #' -#' # get all boxes with grouptag 'ifgi' that are placed outdoors -#' 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 with grouptag 'ifgi' that are placed outdoors +#' 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') +#' } osem_boxes = function (exposure = NA, model = NA, grouptag = NA, date = NA, from = NA, to = NA, phenomenon = NA, endpoint = osem_endpoint(), diff --git a/R/measurement.R b/R/measurement.R index fb344a8..f345bbe 100644 --- a/R/measurement.R +++ b/R/measurement.R @@ -35,9 +35,10 @@ osem_measurements = function (x, ...) UseMethod('osem_measurements') #' @describeIn osem_measurements Get measurements from \strong{all} senseBoxes. #' @export #' @examples -#' # get measurements from all boxes -#' m1 = osem_measurements('Windrichtung') -#' +#' \donttest{ +#' # get measurements from all boxes +#' m1 = osem_measurements('Windrichtung') +#' } osem_measurements.default = function (x, ...) { bbox = structure(c(-180, -90, 180, 90), class = 'bbox') osem_measurements(bbox, x, ...) @@ -48,14 +49,15 @@ osem_measurements.default = function (x, ...) { #' @describeIn osem_measurements Get measurements by a spatial filter. #' @export #' @examples -#' # get measurements from sensors within a bounding box -#' 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') +#' \donttest{ +#' # get measurements from sensors within a bounding box +#' 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') +#' } osem_measurements.bbox = function (x, phenomenon, exposure = 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. #' @export #' @examples -#' # 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') +#' \donttest{ +#' # 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') +#' } osem_measurements.sensebox = function (x, phenomenon, exposure = NA, from = NA, to = NA, columns = NA, ..., diff --git a/R/phenomena.R b/R/phenomena.R index a6caa06..1e0b94d 100644 --- a/R/phenomena.R +++ b/R/phenomena.R @@ -24,9 +24,10 @@ osem_phenomena = function (boxes) UseMethod('osem_phenomena') #' ) #' #' # get phenomena with at least 30 sensors on opensensemap -#' phenoms = osem_phenomena(osem_boxes()) -#' names(phenoms[phenoms > 29]) -#' +#' \donttest{ +#' phenoms = osem_phenomena(osem_boxes()) +#' names(phenoms[phenoms > 29]) +#' } osem_phenomena.sensebox = function (boxes) { p = Reduce(`c`, boxes$phenomena) %>% # get all the row contents in a single vector table() %>% # get count for each phenomenon diff --git a/README.md b/README.md index 4b76fca..2abb0e1 100644 --- a/README.md +++ b/README.md @@ -7,18 +7,26 @@ The package aims to be compatible with sf and the tidyverse. ## 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 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 -A verbose usage example is shown in the vignette [`osem-intro`](https://noerw.github.com/opensensmapR/inst/doc/osem-intro.html). -Each functions documentation can be viewed with `?`. +Each function's documentation can be viewed with `?`. 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: ```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). -## FAQ - -- *Whats up with that package name?* idk, the R people seem to [enjoy][1] [dropping][2] [vovels][3] so.. -Unfortunately I couldn't fit the naming convention to drop an `y` in there. - -[1]: https://github.com/tidyverse/readr -[2]: https://github.com/tidyverse/dplyr -[3]: https://github.com/tidyverse/tidyr +## Contributing & Development -## Development +Contributions are very welcome! +When submitting a patch, please follow the existing [code style](.lintr), +and run `R CMD check --no-vignettes .` on the package. 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. diff --git a/man/opensensmapr.Rd b/man/opensensmapr.Rd index 1cd5da0..0a147a8 100644 --- a/man/opensensmapr.Rd +++ b/man/opensensmapr.Rd @@ -92,7 +92,7 @@ openSenseMap API: \url{https://api.opensensemap.org/} official openSenseMap API documentation: \url{https://docs.opensensemap.org/} } \author{ -\strong{Maintainer}: Norwin Roosen \email{bugs@nroo.de} +\strong{Maintainer}: Norwin Roosen \email{hello@nroo.de} Other contributors: \itemize{ diff --git a/man/osem_boxes.Rd b/man/osem_boxes.Rd index cb845fa..d8b5c9b 100644 --- a/man/osem_boxes.Rd +++ b/man/osem_boxes.Rd @@ -41,15 +41,16 @@ Note that some filters do not work together: } } \examples{ -# get *all* boxes available on the API -b = osem_boxes() +\donttest{ + # get *all* boxes available on the API + b = osem_boxes() -# get all boxes with grouptag 'ifgi' that are placed outdoors -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 with grouptag 'ifgi' that are placed outdoors + 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') +} } \seealso{ \href{https://docs.opensensemap.org/#api-Measurements-findAllBoxes}{openSenseMap API documentation (web)} diff --git a/man/osem_measurements.Rd b/man/osem_measurements.Rd index 84a248f..f10d9c5 100644 --- a/man/osem_measurements.Rd +++ b/man/osem_measurements.Rd @@ -62,25 +62,28 @@ a bounding box spanning the whole world. }} \examples{ -# get measurements from all boxes -m1 = osem_measurements('Windrichtung') - -# get measurements from sensors within a bounding box -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') - -# 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') - +\donttest{ + # 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') + + 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') +} +\donttest{ + # 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') +} } \seealso{ \href{https://docs.opensensemap.org/#api-Measurements-getDataMulti}{openSenseMap API documentation (web)} diff --git a/man/osem_phenomena.Rd b/man/osem_phenomena.Rd index f16e823..7f744e0 100644 --- a/man/osem_phenomena.Rd +++ b/man/osem_phenomena.Rd @@ -35,9 +35,10 @@ osem_phenomena( ) # get phenomena with at least 30 sensors on opensensemap -phenoms = osem_phenomena(osem_boxes()) -names(phenoms[phenoms > 29]) - +\donttest{ + phenoms = osem_phenomena(osem_boxes()) + names(phenoms[phenoms > 29]) +} } \seealso{ \code{\link{osem_boxes}}