Variable
class Variable
A variable (column) of a table, query, or upload, including its metadata (name, type, label, description, and value labels) and summary statistics.
Constructors
Table.variable(name)
Return a Variable of a table.
Table.listVariables([maxResults])
List the Variables of a table.
Query.variable(name)
Return a Variable of a query's output.
Query.listVariables([maxResults])
List the Variables of a query's output.
Upload.variable(name)
Return a Variable of an upload.
Upload.listVariables([maxResults])
List the Variables of an upload.
Examples
const table = redivis.organization('demo').dataset('iris_species').table('iris');
const variable = table.variable('SepalLengthCm');
await variable.get();
console.log(variable.properties);
// { kind: 'variable', name: 'SepalLengthCm', type: 'float', ... }
const statistics = await variable.getStatistics();
// { kind: 'variableStatistics', status: 'completed', count: 150, numDistinct: 35, min: 4.3, max: 7.9, ... }
// For tables in an unreleased version of a dataset, update metadata
await variable.update({ label: 'Sepal length (cm)', description: 'The length of the sepal' });Attributes
name
The variable's name.
type
The variable's type (e.g., integer, string), once its properties are populated.
table
The Table the variable belongs to, if any.
query
The Query the variable belongs to, if any.
upload
The Upload the variable belongs to, if any.
properties
An object containing the API resource representation of the variable. This will only be populated after certain methods are called, particularly the get method.
Methods
Check whether the variable exists.
Fetch the variable's metadata, populating variable.properties.
Variable.getStatistics([options])
Return the variable's summary statistics.
Variable.update(options)
Update the variable's metadata.
Was this helpful?

