Skip to contents

Combine multiple ScaleSpec objects into one in regards of sum_items_to_scale() function. Useful when one scale of factor contains items of different possible values or if there is hierarchy of scale or factors.

Also allows combining CombScaleSpec object if the factor structure have deeper hierarchy.

Usage

CombScaleSpec(name, ..., reverse = character(0))

# S3 method for CombScaleSpec
print(x, ...)

# S3 method for CombScaleSpec
summary(object, ...)

Arguments

name

Name of the combined scale or factor

...

further arguments passed to or from other methods.

reverse

character vector containing names of the underlying subscales or factors that need to be reversed

x

a CombScaleSpec object

object

a CombScaleSpec object

Value

CombScaleSpec object

See also

Other item preprocessing functions: ScaleSpec(), sum_items_to_scale()

Examples

# ScaleSpec objects to Combine

first_scale <- ScaleSpec(
  name = "First Scale",
  item_names = c("Item_1", "Item_2"),
  min = 1,
  max = 5
)

second_scale <- ScaleSpec(
  name = "Second Scale",
  item_names = c("Item_3", "Item_4"),
  min = 0,
  max = 7,
  reverse = "Item_3"
)

third_scale <- ScaleSpec(
  name = "Third Scale",
  item_names = c("Item_5", "Item_6"),
  min = 1,
  max = 5
)

# You can combine few ScaleSpec objects into CombScaleSpec

first_comb <- CombScaleSpec(
  name = "First Comb",
  first_scale,
  second_scale,
  reverse = "Second Scale"
)

print(first_comb)
#> <CombScaleSpec>: First Comb
#> Total items: 4
#> Underlying objects:
#> 1. <ScaleSpec> First Scale [No.items: 2]
#> 2. <ScaleSpec> Second Scale [No.items: 2]

# And also other CombScaleSpec objects!

second_comb <- CombScaleSpec(
  name = "Second Comb",
  first_comb,
  third_scale
)

print(second_comb)
#> <CombScaleSpec>: Second Comb
#> Total items: 6
#> Underlying objects:
#> 1. <CombScaleSpec> First Comb [No.items: 4]
#> 2. <ScaleSpec> Third Scale [No.items: 2]