Reference
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()
)
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 abit64:int64
) - float:
double
- date:
Date
- dateTime:
POSIXlt
- time:
hms
- boolean:
logical
- string:
character vector
- geography:
sfgeometry | string
(see below)
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.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. 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.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.
Last modified 7mo ago