MyNixOS website logo
Description

Client for the 'FieldClimate' API.

Provides functionality to interact with the 'FieldClimate' API <https://api.fieldclimate.com/v2/docs/>.

rfieldclimate

Lifecycle:maturing CRANstatus R buildstatus Codecov testcoverage

An R client for Fieldclimate API

Installation

remotes::install_github("basf/rfieldclimate")

Examples

library("rfieldclimate")

Authentication

rfieldclimate uses HMAC for authentication.

The public and private keys are read by default from environmental variables FC_PUBLIC_KEY and FC_PRIVATE_KEY, but you can provide them also in every function call using the public_key= and private_key= arguments.

Basic use

fc_request() is the workhorse of this package.

With it you can query every API endpoint, e.g.

fc_request(method = "GET", path = "/system/types") %>%
  head(2)

See the Routes tables API documentation for details. URL parameters must be included in the path= arguments, the request body in body=.

Wrappers

With fc_request() all the api functionality can be easily covered. Additionally, we provide some wrappers around endpoints.

E.g. the wrapper for station information (see below) is defined as

fc_get_station
#> function(station_id = NULL, ...) {
#>   stopifnot(!is.null(station_id))
#>   path <- file.path('/station', station_id)
#>   fc_request(method = "GET", path = path, ...)
#> }
#> <bytecode: 0x55b67f00f260>
#> <environment: namespace:rfieldclimate>

For a few other endpoints wrapper functions are provided:

  • fc_get_user() to list user information
  • fc_get_user_stations() to list available stations
  • fc_get_station() to get station information
  • fc_get_data() to get data range of a station
  • fc_get_data_range() to get data in range

Feel free to add more wrappers (as described above).

Parsers

We provide also convenience wrappers for objects, like

  • fc_parse_data() to parse the object returned by fc_get_data_range() into a long format data.frame
  • fc_parse_stations() to parse the object returned by fc_get_user_stations() into a data.frame

Unit tests

To run the full test suite with 100% coverage set valid environmental variables FC_PUBLIC_KEY and FC_PRIVATE_KEY and run devtools::test().

Metadata

Version

0.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows