setObsVar: Set an observed variable

View source: R/setObsVar.R

setObsVarR Documentation

Set an observed variable

Description

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.

Usage

setObsVar(
  schema = NULL,
  name = NULL,
  columns = NULL,
  top = NULL,
  distinct = FALSE,
  unit = NULL,
  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 measured variable.

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.

unit

[character(1)]
the unit of this variable.

factor

[numeric(1)]
the factor that needs to be multiplied with the values to convert to 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.

Details

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

Value

An object of class schema.

See Also

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

Examples

# please check the vignette for examples

tabshiftr documentation built on Feb. 16, 2023, 10:24 p.m.