VariableDefinition {crunch}R Documentation

Construct a variable definition

Description

Crunch variables are created by posting a VariableDefinition to the Crunch server. The VariableDefinition contains the information the server requires to calculate the variable. This can information can either be in the form of the actual data which you would like to include in the variable, or a derivation which tells the server how to derive the new variable from existing ones. This function converts an R vector or set of attributes into a variable definition which can be posted to the server.

Usage

VariableDefinition(data, ...)

VarDef(data, ...)

Arguments

data

an R vector of data to convert to the Crunch payload format. See toVariable for how R data types are converted. This function can also be used to construct a VariableDefinition directly by passing attributes to .... This is only recommended for advanced users who are familiar with the Crunch API.

...

additional attributes to be included in the VariableDefinition

Value

a VariableDefinition object, ready to POST to Crunch.

See Also

toVariable

Examples

VariableDefinition(rnorm(5),
    name = "Some numbers",
    description = "Generated pseudorandomly from the normal distribution"
)
VarDef(
    name = "Integers", values = 1:5, type = "numeric",
    description = "When creating variable definitions with 'values', you must
    specify 'type', and categorical variables will require 'categories'."
)

[Package crunch version 1.30.4 Index]