# Reference

The `redivis` R package provides an interface to construct representations of Redivis entities and to create, modify, read, and delete them.&#x20;

Resources are generally constructed by chaining together multiple constructor methods, reflecting the hierarchical nature of entities in Redivis. For example, to list all variables on table (which belongs to a dataset in an organization), we would write:

```r
library("redivis") 

variables = (
    redivis$organization("Demo")      # Returns an instance of an Organization
    $dataset("CMS 2014 Medicare Data"  # Returns an instance of a Dataset
    $table("Home health agencies")     # Returns an instance of a Table
    $list_variables()                  # Retuns a list of Variable instances
)
```

## Interfaces

| [**`redivis`**](/api/client-libraries/redivis-r.md)                             | The redivis namespace. Provides constructor methods for most of the other classes.                                                                                                     |
| ------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [**`Dataset`**](/api/client-libraries/redivis-r/reference/dataset.md)           | Class representing a Redivis dataset. Provides constructor methods for Tables and Queries scoped to a given dataset, as well as methods for creating, deleting, and updating datasets. |
| [**`File`**](/api/client-libraries/redivis-r/reference/file.md)                 | Class representing a non-tabular file on Redivis.                                                                                                                                      |
| [**`Organization`**](/api/client-libraries/redivis-r/reference/organization.md) | Class representing a Redivis organization. Provides constructor methods for Datasets and Workflows scoped to a given organization.                                                     |
| [**`Workflow`**](/api/client-libraries/redivis-r/reference/workflow.md)         | Class representing a Redivis workflow. Provides constructor methods for Tables and Queries scoped to a given workflow.                                                                 |
| [**`Query`**](/api/client-libraries/redivis-r/reference/query.md)               | Class representing a running SQL query that references tables on Redivis.                                                                                                              |
| [**`Table`**](/api/client-libraries/redivis-r/reference/table.md)               | Class representing a Redivis table. Numerous methods available for reading data from the table, as well as uploading data and metadata.                                                |
| [**`User`**](/api/client-libraries/redivis-r/reference/user.md)                 | Class representing a Redivis user. Provides constructor methods for Datasets and Workflows scoped to a given user.                                                                     |
| [**`Variable`**](/api/client-libraries/redivis-r/reference/variable.md)         | Class representing a specific variable with a Table.                                                                                                                                   |

## Environment variables

The following [environment variables](https://www.twilio.com/blog/environment-variables-python) may be set to modify the behavior of the `redivis-r` client.&#x20;

#### REDIVIS\_API\_TOKEN

If using this library in an external environment, you'll need set this env variable to your [API token](/api/rest-api/authorization.md) in order to authenticate.&#x20;

{% hint style="warning" %}
**Important:** this token acts as a password, and should never be inlined in your code, committed to source control, or otherwise published.
{% endhint %}

#### REDIVIS\_DEFAULT\_WORKFLOW

If set, tables referenced via `redivis$table()` and unqualified table names in `redivis$query()` will be assumed to be within the default workflow.&#x20;

Takes the form `user_name.workflow_name`. All notebooks on Redivis automatically set the default workflow to that notebook's workflow. [Learn more about referencing resource >](/api/referencing-resources.md)

#### 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.&#x20;

Takes the form `owner_name.dataset_name`. If both a default dataset and workflow are set, the default workflow will supersede the dataset. [Learn more about referencing resource >](/api/referencing-resources.md)

#### REDIVIS\_TMPDIR

If set, this directory will be used to temporarily store data for disk-backed data objects (e.g., see [Table$to\_arrow\_dataset](/api/client-libraries/redivis-r/reference/table/tableusdto_arrow_dataset.md)). Otherwise, the default OS temp directory will be used.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.redivis.com/api/client-libraries/redivis-r/reference.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
