Observed variables are those variables that contain the (quantitative) observed/measured values of each unique unit (as described by the identifying variables). There may be several of them and in a tidy table they'd be recorded as separate columns.

setObsVar(
  schema = NULL,
  name = NULL,
  type = "numeric",
  columns = NULL,
  top = NULL,
  distinct = FALSE,
  factor = 1,
  key = NULL,
  value = NULL
)

Arguments

schema

[schema(1)]
In case this information is added to an already existing schema, provide that schema here (overwrites previous information).

name

[character(1)]
Name of the new observed variable.

type

[character(1)]
data type of the new observed variable. Possible values are "c/character", "i/integer", "n/numeric", "l/logical", "D/date" or "_/skip".

columns

[integerish(.)]
The column(s) in which the values of the new variable are recorded.

top

[integerish(.)]
In case the variable is nested in a wide identifying variable, specify here additionally the topmost row in which the variable name sits.

distinct

[logical(1)]
Whether or not the variable is distinct from a cluster. This is the case when the variable is recorded somewhere 'on the side' and thus not explicitly included in all clusters.

factor

[numeric(1)]
the factor that needs to be multiplied with the values to convert to the target unit, defaults to 1. For instance, if values are recorded in acres, but shall be recorded in hectare, the factor would be 0.40468.

key

[integerish(1)]
If the variable is recorded (together with other variables) so that the variable names are listed in one column and the respective values are listed in another column, give here the number of the column that contains the variable names. Can alternatively be "cluster", in case observed variables are the cluster ID.

value

[character(1)]
If the variable is recorded (together with other variables) so that the variable names are listed in one column and the respective values are listed in another column, give here the level in the names column that refer to the values of this variable.

Value

An object of class schema.

Details

Please also take a look at the currently suggested strategy to set up a schema description.

See also

Other functions to describe table arrangement: setCluster(), setFilter(), setFormat(), setGroups(), setIDVar()

Examples

# please check the vignette for examples