Skip to contents

S7 class for hespeR vectors

Usage

HesperVector(
  hesper_var = character(0),
  hesper_vals = character(0),
  allow_missing = FALSE
)

Arguments

hesper_var

(character[1]) A single HESPER item name.

hesper_vals

(character[1+]) A vector of allowed options for the HESPER item.

allow_missing

(logical[1]) Whether missing options are allowed for this HESPER item.

Value

(S7_object) A S7 HesperVector object representing a HESPER item and its allowed options.

Details

The HesperVector class is designed to encapsulate the core properties of HESPER data. It includes the name of a HESPER item (hesper_var) and a vector of allowed options for that item (hesper_vals). The class validates that the hesper_var property is a valid Hesper item (see hesper_vars) and that all values in hesper_vals are within the allowed options (see specified in hesper_opts).

The hesper_bins property is a getter that add a list of binary vectors for the HESPER item. For each possible HESPER option (from hesper_opts()), it returns a binary vector indicating which values in hesper_vals match that option.