# Variables

Variables are present in all [tables](/reference/datasets/data.md) on Redivis. Conceptually, they represent something that is being measured in the data. When viewed in the table cells view, variables are represented by the table's columns.

In order to view variables, you must have [metadata access](/reference/data-access/access-levels.md#metadata-access) the source dataset(s) for the given table.

## Characteristics

The characteristics on a variable help researchers understand what that variable measures and how it was collected. All characteristics are indexed by the Redivis search engine — better and accurate metadata will help researchers find your dataset!&#x20;

These characteristics will only be considered in search results if the user has [metadata access](/reference/data-access/access-levels.md#metadata-access) to the underlying dataset.

| Field            | Notes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Name**         | The name of the variable, limited to 60 characters. Must be unique within the table. All variable names are case-insensitive, and can only use alpha-numeric characters and underscores, and cannot start with a number.                                                                                                                                                                                                                                                                                                                        |
| **Type**         | Required. The data type of the variable. [Learn more about variable types](/reference/tables/variables.md#variable-types).                                                                                                                                                                                                                                                                                                                                                                                                                      |
| **Label**        | Optional. A short, human-readable description of the variable name. Limited to 256 characters.                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| **Description**  | Optional. A longer space for notes about the variable's creation methods, coding, or supplementary information. Limited to 5000 characters.                                                                                                                                                                                                                                                                                                                                                                                                     |
| **Value labels** | <p>Optional. A map of each value in the data to a longer string of information. For example, a variable with records <code>0</code> , <code>1</code> , and <code>2</code> might have value labels for <code>0 = No</code>, <code>1 = Yes</code>, <code>2 = Don't know</code>. <br><br>Value labels will be shown inline on the <a href="/pages/-LWDyu_nl_2qstT0V2uz#overview">cells view</a> of a table, alongside the <a href="/pages/-LWB1uR_T2-TGoCmPoAN#univariate-statistics">frequency table values</a> in the univariate statistics.</p> |

## Univariate statistics

Redivis automatically computes certain statistics for each variable, depending on that variable's type and number of distinct values. To view summary statistics, click on a variable in a [table](/reference/datasets/data.md#comparing-variables).

![Look at univariate statistics by selecting a variable](/files/lUhe8a3r5qFmYGDswXuI)

| Statistic                              | Description                                                                                                                                                                                                                                                                             |
| -------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Count**                              | The total number of values for this variable in the [table](/reference/datasets/data.md). Does not include any [null](/reference/glossary.md#null) values.                                                                                                                              |
| **Distinct**                           | The number of unique values in the table. Does not include [null](/reference/glossary.md#null) as a value. (For example, a variable with values 0, 1, and null will have a distinct of 2.)                                                                                              |
| **Non-null**                           | The percentage of values in the table which are not [null](/reference/glossary.md#null). Calculated by dividing the **Count** by the total number of records in the table.                                                                                                              |
| **Min, max**                           | <p>For <a href="/pages/-LWB1uR_T2-TGoCmPoAN">continuous</a> variables (integer, float, date, dateTime, time): the minimum and maximum of this variable. </p><p></p><p>For <a href="/pages/-LWB1uR_T2-TGoCmPoAN">string</a> variables: the minimum and maximum length of all values.</p> |
| **Min lng, Min lat, Max lng, Max lat** | For geography variables: the bounding box containing all geospatial data in a variable                                                                                                                                                                                                  |
| **μ, σ**                               | The mean and sample (unbiased) standard deviation of the variable. Only available for continuous variables (integer, float, date, dateTime, time).                                                                                                                                      |

## Univariate plots

**Histogram**

A frequency chart of observations, sorted into 64 buckets, clamped to three standard deviations of the mean on either side. To switch between a linear and logarithmic y-axis, click on the bottom left corner of the chart.

Only shown for continuous variables with more than 64 distinct values.

**Box plot**

A visual display of the distribution of values by frequency. Shown are the minimum, 25%, median, 75% and maximum value. To include or exclude outliers in the calculations, click on the label on the bottom left corner of the chart.

Only shown for continuous variables with a meaningful number of discrete values.

{% hint style="info" %}
The box plot uses the [APPROX\_QUANTILES](https://cloud.google.com/bigquery/docs/reference/standard-sql/approximate_aggregate_functions#approx_quantiles) BigQuery method, which will estimate quantiles ([±0.57%, 95% CI](https://cloud.google.com/bigquery/docs/reference/standard-sql/hll_functions)) for larger datasets. As such, the box plot values should only be used as an approximation.
{% endhint %}

**Frequency table**

A table showing the frequency of common values for that variable, limited to 10,000 values. If a variable's values are highly heterogenous, no frequency table will be displayed. You can right click on values to get a quick entry point to filter on that value in the query tab.&#x20;

**Map**

A table with variable of type `geography` shows a heatmap of the geospatial dispersion of that variable.

## Editing metadata

To edit a variable's label, description, or value labels, click the **Edit metadata** button on the right of any table. This will allow you to any of the variables in this table, or you can navigate to the "All tables" tab to edit the same variable across multiple tables.

In the metadata editor, you can edit a variable's metadata fields as you would in any spreadsheet, and save changes when you're done.

When working in bulk, you can also [upload metadata directly](/reference/datasets/create-and-edit-datasets/populate-metadata.md).

![](/files/HY3Q6cpuNBczVKM153Op)

### Exporting metadata

You can export your metadata at any time (in either of the above formats) by clicking **Export file** in the variable metadata editor. Variable metadata is also available in JSON format via the [variables.list](/api/rest-api/variables.md) API endpoint.

## Variable types

All variables in Redivis have a type associated with them. All types in Redivis support `NULL` values; that is, an empty cell.

### **String**

A string can be used to store any textual data (UTF-8 encoded). Moreover, a string is a "universal" data type — any other type can be converted to a string without error.

Size: 2 bytes + UTF-8 encoded string size

### **Integer**

A 64-bit signed integer. Supports any integer value between `-9,223,372,036,854,775,808` and `9,223,372,036,854,775,807` .&#x20;

Size: 8 bytes per cell

### **Float**

A 64-bit (double precision) [floating point](https://en.wikipedia.org/wiki/Floating-point_arithmetic) decimal value.&#x20;

Size: 8 bytes per cell

### **Boolean**

A representation of either `TRUE` or `FALSE`

Size: 1 byte per cell

### **Date**

Represents a calendar date independent of time zone. Supports any value between `0001-01-01` and `9999-12-31`

Size: 8 bytes per cell

Format:

`'YYYY-[M]M-[D]D'`

* `YYYY`: Four digit year
* `[M]M`: One or two digit month
* `[D]D`: One or two digit day

All values in brackets are optional. If your Date is not in this format, you can convert it using [format strings](/reference/workflows/transforms/step-retype.md#reference-format-elements). Redivis will attempt to convert other [common date formats on upload](/reference/datasets/create-and-edit-datasets/import-tabular-data.md#variable-names-and-types), when possible.

### **DateTime**

Represents a year, month, day, hour, minute, second, and subsecond, independent of timezone. Supports any value between `0001-01-01 00:00:00` and `9999-12-31 23:59:59.999999`

Size: 8 bytes per cell

Format:

```
'YYYY-[M]M-[D]D[( |T)[H]H:[M]M:[S]S[.DDDDDD]]'
```

* `YYYY`: Four digit year
* `[M]M`: One or two digit month
* `[D]D`: One or two digit day
* `( |T)`: A space or a `T`separator
* `[H]H`: One or two digit hour (valid values from 00 to 23)
* `[M]M`: One or two digit minutes (valid values from 00 to 59)
* `[S]S`: One or two digit seconds (valid values from 00 to 59)
* `[.DDDDDD]`: Up to six fractional digits (i.e. up to microsecond precision)

All values in brackets are optional. If your DateTime is not in this format, you can convert it using [format strings](/reference/workflows/transforms/step-retype.md#reference-format-elements). Redivis will attempt to convert other [common datetime formats on upload](/reference/datasets/create-and-edit-datasets/import-tabular-data.md#variable-names-and-types), when possible.

### **Time**

Represents a time, independent of a specific date. Supports values between `00:00:00` and `23:59:59.999999`&#x20;

Size: 8 bytes per cell

Format:

```
'[H]H:[M]M:[S]S[.DDDDDD]'
```

* `[H]H`: One or two digit hour (valid values from 00 to 23)
* `[M]M`: One or two digit minutes (valid values from 00 to 59)
* `[S]S`: One or two digit seconds (valid values from 00 to 59)
* `[.DDDDDD]`: Up to six fractional digits (i.e. up to microsecond precision)

All values in brackets are optional. If your Time is not in this format, you can convert it using [format strings](/reference/workflows/transforms/step-retype.md#reference-format-elements). Redivis will attempt to convert other [common time formats on upload](/reference/datasets/create-and-edit-datasets/import-tabular-data.md#variable-names-and-types), when possible.

### **Geography**

Represents a Point, Multipoint, Linestring, MultiLinestring, Polygon, or MultiPolygon geometry, as specified by the [GeoJSON standard](https://geojson.org/).

You can create or manipulate geographic variables using various [methods](/reference/workflows/transforms/step-create-variables.md).

Size: 16 logical bytes + (24 logical bytes \* number of vertices)

Format:

The [WKT format](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) is used to show cell values, though each geography cell can also be viewed on a map by clicking on that cell within a table.

```
'(POINT|MULTIPOINT|LINESTRING|MULTILINESTRING|POLYGON|MULTIPOLYGON)(...)'

-- Multiple of above geometries may be wrapped with
'(GEOMETRYCOLLECTION)(...)'
```

## Conversion rules

Some types can be implicitly converted within a query (e.g., `1 (integer) < 2.2 (float)`), in other circumstances, you will explicitly need to convert the type of a variable before performing certain operations (e.g., `"1.0" (string) < 2.2 (float)`).

Variable types can be converted within the [transform](/reference/workflows/transforms.md) interface in a [workflow](/reference/workflows.md). The following conversions are supported:

| From      | To        | Rule(s) when casting x                                                                                                                                                                                                                                                                               |
| --------- | --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Integer   | Float     | Returns a close but potentially not exact FLOAT64 value.                                                                                                                                                                                                                                             |
| Integer   | Boolean   | Returns `FALSE` if `x` is `0`, `TRUE` otherwise.                                                                                                                                                                                                                                                     |
| Float     | Integer   | <p>Returns the closest INT64 value.<br>Halfway cases such as 1.5 or -0.5 round away from zero.</p>                                                                                                                                                                                                   |
| Float     | String    | <p>Returns an approximate string representation.<br></p>                                                                                                                                                                                                                                             |
| Date      | DateTime  | Returns a DateTime at midnight on the corresponding date. For example, if `x` is `1970-01-01`, returns `1970-01-01 00:00:00`                                                                                                                                                                         |
| DateTime  | Date      | Returns the part of the DateTime which is the calendar date. Note that this will not round the DateTime to the nearest Date. E.g., if `x` is `1970-01-01 23:59:59` , returns `1970-01-01` .                                                                                                          |
| DateTime  | Time      | Returns the part of the DateTime which is the clock time. E.g., if `x` is `1970-01-01 23:59:59` , returns `23:59:59` .                                                                                                                                                                               |
| Boolean   | Integer   | Returns `1` if `x` is `TRUE`, `0` otherwise.                                                                                                                                                                                                                                                         |
| Boolean   | String    | Returns `"true"` if `x` is `TRUE`, `"false"` otherwise.                                                                                                                                                                                                                                              |
| String    | Float     | <p>Returns <code>x</code> as a FLOAT64 value, interpreting it as having the same form as a valid FLOAT64 literal.<br>Also supports casts from <code>"inf"</code>, <code>"+inf"</code>, <code>"-inf"</code>, and <code>"nan"</code>.<br>Conversions are case-insensitive.</p>                         |
| String    | Boolean   | <p>Returns <code>TRUE</code> if <code>x</code> is <code>"true"</code> and <code>FALSE</code> if <code>x</code> is <code>"false"</code><br>All other values of <code>x</code> are invalid and throw an error instead of casting to BOOL.<br>STRINGs are case-insensitive when converting to BOOL.</p> |
| String    | Geography | Use [`ST_GEOGFROM`](/reference/workflows/transforms/variable-creation-methods/geography.md#geo-from) new variable method.                                                                                                                                                                            |
| Geography | String    | Use [`ST_ASTEXT`](/reference/workflows/transforms/variable-creation-methods/geography.md#as-text) new variable method.                                                                                                                                                                               |


---

# 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/reference/tables/variables.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.
