# Table

## *class* <mark style="color:purple;">Table</mark>

Tables are the fundamental data-containing entity in Redivis. Various methods on this class allow you to read data from Redivis tables into R.

## Examples

{% tabs %}
{% tab title="Read data" %}

```r
library("redivis")

# Specify the table's container, either a dataset or workflow
dataset <- redivis$organization("Demo")$dataset("iris_species")

table <- dataset$table("Iris")
table$to_tibble()
# 	Id	SepalLengthCm	SepalWidthCm	PetalLengthCm	PetalWidthCm	Species
# 0	33	5.2	        4.1	        1.5	        0.1	        Iris-setosa
# ...

# Other methods to read data:
# table$to_arrow_batch_reader()
# table$to_arrow_dataset()
# table$to_arrow_dataset()
# table$to_data_frame()
# table$to_data_table()
# table$to_sf_tibble()
```

{% endtab %}

{% tab title="Download files" %}

<pre class="language-r"><code class="lang-r">library("redivis")

<strong>dataset &#x3C;- redivis$user("demo")$dataset("Example non-tabular files")
</strong>table &#x3C;- dataset$table("tiffs")

table$download_files("/path/to/directory", overwrite=TRUE)
</code></pre>

{% endtab %}
{% endtabs %}

## Constructors

<table data-header-hidden><thead><tr><th width="312">Method</th><th>Description</th></tr></thead><tbody><tr><td><a href="/pages/47nLIEzZXk9JRwnHBr1Q"><strong><code>redivis$table</code></strong></a>(reference)</td><td>Return a Table within the <a href="/pages/-MbEPjMatWDWThjAxSWK#environment-variables">current default scope</a> (either a dataset or workflow). In a Redivis notebook, the default scope will always be the notebook's workflow.</td></tr><tr><td><a href="/pages/IKVZOb4qlHQhYdGNSnnJ"><strong><code>Dataset$table</code></strong></a>(reference)</td><td>Return a Table within a specific <a href="/pages/rTkK9meEB3v1Yq1JBXBO">dataset</a>.</td></tr><tr><td><a href="/pages/CVDE36VyVVwAHkSOzpsJ"><strong><code>Workflow$table</code></strong></a>(reference)</td><td>Return a Table within a specific <a href="/pages/DoBxAvwsPMfXoajo17w9">workflow</a>.</td></tr></tbody></table>

## Attributes

| **`properties`** | A named list containing the [API resource representation of the table](/api/resource-definitions/table.md#base-definition). This will only be populated after one of the table methods that read data are called. |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

## Methods

<table data-header-hidden><thead><tr><th width="441"></th><th></th></tr></thead><tbody><tr><td><strong>Reading data and metadata</strong></td><td></td></tr><tr><td><a href="/pages/4wlUFsfEUs3EdBhd8QDz"><strong><code>Table$download</code></strong></a>([path, format, ...])</td><td>Export a table in a particular format and download it to disk.</td></tr><tr><td><a href="/pages/lOv0s06r3e6JLsn0Pusr"><strong><code>Table$exists</code></strong></a>()</td><td>Check whether the table exists</td></tr><tr><td><a href="/pages/kQT1Kj1hIJ5h93je8J0E"><strong><code>Table$file</code></strong></a>(name, [...])</td><td>Reference a <a href="/pages/Efg4GRC3Ls4uKecAFFnb">File</a> within a file index table.</td></tr><tr><td><a href="/pages/juIBmETXz4VVC5OrRmut"><strong><code>Table$get</code></strong></a>()</td><td>Fetch table metadata. Once called, the <code>properties</code> field on the table will be fully populated.</td></tr><tr><td><a href="/pages/Iom6bLQoStWzWG15GhPg"><strong><code>Table$list_files</code></strong></a>([max_results, ...])</td><td>Return a list of <a href="/pages/Efg4GRC3Ls4uKecAFFnb">File</a> instances in a file index table.</td></tr><tr><td><a href="/pages/rLglmLALg0J8tSK8Je4y"><strong><code>Table$list_variables</code></strong></a>([max_results])</td><td>Return a list of <a href="/pages/1wbhMDvUFAP4hpABOpVe">Variable</a> instances associated with this table.</td></tr><tr><td><a href="/pages/e90j3OoqSIuTAcpVymaH"><strong><code>Table$to_arrow_batch_reader</code></strong></a>([...])</td><td>Returns a reader that mimics the <a href="https://arrow.apache.org/docs/dev/r/reference/RecordBatchReader.html">Arrow RecordBatchStreamReader</a>, which can then be consumed to process batches of rows in a streaming fashion.</td></tr><tr><td><a href="/pages/MsPAs6r0SE0qrfHi9tFj"><strong><code>Table$to_arrow_dataset</code></strong></a>([max_results, ...])</td><td>Return an <a href="https://arrow.apache.org/docs/r/reference/Dataset.html">Arrow Dataset</a> for the table. Data is backed by disk, allowing for larger-than-memory analysis.</td></tr><tr><td><a href="/pages/kbaRuROEXJ1fG8oeKL1R"><strong><code>Table$to_arrow_table</code></strong></a>([max_results, ...])</td><td>Return an <a href="https://arrow.apache.org/docs/r/reference/Table-class.html">Arrow Table</a> with the table's data. This is the highest-performance option for loading data in-memory.</td></tr><tr><td><a href="/pages/hylvPhzmz9JBfKYhd8MW"><strong><code>Table$to_data_frame</code></strong></a>([max_results, ...])</td><td>Return a <a href="https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/data.frame">data.frame</a> with the table's data.</td></tr><tr><td><a href="/pages/6KvS8uwthfQ9vStIdISd"><strong><code>Table$to_data_table</code></strong></a>([max_results, ...])</td><td>Return a <a href="https://rdatatable.gitlab.io/data.table/">data.table</a> with the table's data.</td></tr><tr><td><a href="/pages/XJia14pBZVf2jusqPaVF"><strong><code>Table$to_directory</code></strong></a>([max_results, ...])</td><td>Return a virtual <a href="/pages/KEqiUXmv4avxw45DwtuZ">Directory</a> based off a file index table.</td></tr><tr><td><a href="/pages/M9kbmvsK2BXrLYHaMy13"><strong><code>Table$to_read_streams</code></strong></a>([target_count, ...])</td><td>Return a list of <a href="/pages/Rcj79YBN88zSuR6NsSUZ">ReadStreams</a> for parallel processing.</td></tr><tr><td><a href="/pages/CvIqQ63LSR7YE2ORvrNl"><strong><code>Table$to_tibble</code></strong></a>([max_results, variables, ...])</td><td>Return a <a href="https://tibble.tidyverse.org/">tibble</a> with the table's data.</td></tr><tr><td><a href="/pages/FdhRrQS7Ds8yTogJ6KdP"><strong><code>Table$to_sf_tibble</code></strong></a>([max_results, ...])</td><td>Return a <a href="https://r-spatial.github.io/sf/index.html">simple features tibble</a> with a table's data. Used for tables that contain a geography variable.</td></tr><tr><td><a href="/pages/CxEzkuN9J2UdI2UKBQQy"><strong><code>Table$variable</code></strong></a>(name)</td><td>Reference a <a href="/pages/1wbhMDvUFAP4hpABOpVe">Variable</a> within the table.</td></tr><tr><td></td><td></td></tr><tr><td><strong>Uploading and modifying data</strong></td><td></td></tr><tr><td><a href="/pages/skPbClzwi02c3HA4uQ82"><strong><code>Table$add_files</code></strong></a>([files, directory])</td><td>Upload non-tabular (unstructured) files to an unreleased file index table. </td></tr><tr><td><a href="/pages/sG9WB8D6C1KXid6nTC6I"><strong><code>Table$create</code></strong></a>([description, ...])</td><td>Create a table within a dataset if it doesn't already exist. Table must belong to an unreleased version of the dataset.</td></tr><tr><td><a href="/pages/YUbVZ1CzsiGvaoEnL9iF"><strong><code>Table$delete</code></strong></a>()</td><td>Delete a table belonging to an unreleased version of a dataset.</td></tr><tr><td><a href="/pages/HjOlKyEOajUVTPxmievE"><strong><code>Table$list_uploads</code></strong></a>([max_results])</td><td>Return a list of all uploads on a table.</td></tr><tr><td><a href="/pages/IR4LkDmdX6HBqVmHCpDy"><strong><code>Table$update</code></strong></a>([name, description, ...])</td><td>Update various properties on the table.</td></tr><tr><td><a href="/pages/mHTOa3tCk3LGpWlPCr8z"><strong><code>Table$update_variables</code></strong></a>(variables)</td><td>Bulk update variable metadata on a table.</td></tr><tr><td><a href="/pages/gcMUioymgDdOS8OeQyf2"><strong><code>Table$upload</code></strong></a>(name)</td><td>Construct a new <a href="/pages/TF25DHFMawPZCFWq9QWq">upload instance</a>, scoped to this table.</td></tr></tbody></table>


---

# 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/table.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.
