Browse Source

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! :}
tags/v0.4.0
noerw 1 year ago
parent
commit
4f95ae19a8
11 changed files with 93 additions and 75 deletions
  1. 4
    0
      .aspell/defaults.R
  2. BIN
      .aspell/opensensmapr.rds
  3. 6
    5
      DESCRIPTION
  4. 8
    7
      R/box.R
  5. 20
    17
      R/measurement.R
  6. 4
    3
      R/phenomena.R
  7. 16
    13
      README.md
  8. 1
    1
      man/opensensmapr.Rd
  9. 8
    7
      man/osem_boxes.Rd
  10. 22
    19
      man/osem_measurements.Rd
  11. 4
    3
      man/osem_phenomena.Rd

+ 4
- 0
.aspell/defaults.R View 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 View File


+ 6
- 5
DESCRIPTION View File

@@ -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 <https://opensensemap.org> 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

+ 8
- 7
R/box.R View File

@@ -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(),

+ 20
- 17
R/measurement.R View File

@@ -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,
...,

+ 4
- 3
R/phenomena.R View File

@@ -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

+ 16
- 13
README.md View File

@@ -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 `?<function-name>`.
Each function's documentation can be viewed with `?<function-name>`.
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.

+ 1
- 1
man/opensensmapr.Rd View File

@@ -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{

+ 8
- 7
man/osem_boxes.Rd View File

@@ -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)}

+ 22
- 19
man/osem_measurements.Rd View File

@@ -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)}

+ 4
- 3
man/osem_phenomena.Rd View File

@@ -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}}

Loading…
Cancel
Save