# Reading tabular data

### Read table data into R

```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()
```

### Read table metadata

```r
library("redivis")

table <- redivis$organization("Demo")$dataset("iris_species")$table("iris")

variable <- table$variable("sepalLengthCm")
variable$get() 

print(variable$properties)

{
  "kind": "variable",
  ... (see variable resource definition)
}

print(variable$get_statistics())
{
  "kind": "variableStatistics"
  "status": "completed",
  "count": 150,
  "numDistinct": 35,
  "min": 4.3,
  "max": 7.9,
  "mean": 5.8433333333333355,
  "approxMedian": 0.8280661279778625,
  ...
}
```

### Load a table within a Redivis notebook

<pre class="language-r"><code class="lang-r"><strong># In a notebook, all tables are scoped to the current workflow.
</strong># Additionally, the notebook's source table can simply be referenced as _source_
table = redivis$table("_source_")

table$to_tibble()
</code></pre>


---

# 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/examples/reading-tabular-data.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.
