Codes related to unit at another frame, found through the atoms. scale_children()/scale_parents() step one frame down/up by default; scale_descendants()/scale_ancestors() report every finer/coarser frame as a frame-tagged table.

scale_children(x, frame, unit, to = NULL)

scale_parents(x, frame, unit, to = NULL)

scale_descendants(x, frame, unit, to = NULL)

scale_ancestors(x, frame, unit, to = NULL)

Arguments

x

A NestedScale.

frame

The frame unit belongs to.

unit

Character vector of codes.

to

Target frame. NULL uses the adjacent frame (children/parents) or every finer/coarser frame (descendants/ancestors).

Value

A character vector (children/parents) or a data.frame with columns frame and unit (descendants/ancestors).

Examples

s <- scale_example()
scale_children(s, "sector", "P")
#> [1] "G1" "G2"
scale_parents(s, "unit", "U5")
#> [1] "GB"
scale_descendants(s, "sector", "P")
#>   frame unit
#> 1 class   G1
#> 2 class   G2
#> 3 group   G1
#> 4 group   GB
#> 5  unit   U1
#> 6  unit   U2
#> 7  unit   U3
#> 8  unit   U4
scale_ancestors(s, "unit", "U5")
#>    frame unit
#> 1 sector    S
#> 2  class   S1
#> 3  group   GB