Links

Reference

Overview

The redivis R library provides an interface to construct representations of Redivis entities and to create, modify, read, and delete them.
Resources are generally constructed by chaining together multiple constructor methods, reflecting the hierarchical nature of entities in Redivis. For example, to get the tidyverse tibble for a table (which belongs to a dataset in an organization), we would write:
library(redivis)
df <- (
redivis::organization("Demo")
$dataset("CMS 2014 Medicare Data")
$table("nursing_facilities")
$to_tibble()
)

Reading data

When reading data from a table or query, the results will be return as a tidyverse tibble (via the .to_tibble() method).
The type of each column vector in the tibble is automatically set according to the variable type in Redivis, based on the following mapping:
  • integer: integer (unless any values exceed that max integer value — R only supports 32-bit integers — in which case it will be returned as a bit64:int64 )
  • float: double
  • date: Date
  • dateTime: POSIXlt
  • time: hms
  • boolean: logical
  • string: character vector
  • geography: sfgeometry | string (see below)

Geographic variables

If your data contains a variable of type geography, by default the to_tibble() method will return a Simple Features (SF) tibble, which extends the base tidyverse tibble with powerful GIS functionality. A SF tibble contains a single column that is specified as its geospatial index — by default, this will be the first geography variable encountered, though you can explicitly set it to another variable: table$to_tibble(geography_variable="variable_name") .
If you have geography variables but would prefer to not use Simple Features, specify geography_variable=None in the arguments. In this case, all geography variables will be stored as character vectors using the WKT encoding.

Environment variables

The following environment variables may be set to modify the behavior of the redivis-r client.

REDIVIS_DEFAULT_PROJECT

If set, tables referenced via redivis::table() and unqualified table names in redivis::query() will be assumed to be within the default project.
Takes the form user_name.project_name. All notebooks on Redivis automatically set the default project to that notebook's project.

REDIVIS _DEFAULT_DATASET

If set, tables referenced via redivis::table() and unqualified table names in redivis::query() will be assumed to be within the default dataset.
Takes the form owner_name.project_name. If both a default dataset and project are set, the default project will supersede the dataset.

REDIVIS_API_TOKEN

If using this library in an external environment, you'll need set this env variable to your API token in order to authenticate.
Important: this token acts as a password, and should never be inlined in your code, committed to source control, or otherwise published.