The one-row-per-atom table the scale is built on, as a plain data.frame – the exported accessor to prefer over reaching for x@leaftable. as.data.frame() and ggplot2::fortify() on a NestedScale are equivalent, so ggplot(s) + geom_*() pipelines work directly.

scale_leaftable(x)

# S3 method for class 'NestedScale'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

# S3 method for class '`nestedscales::NestedScale`'
as.data.frame(x, row.names = NULL, optional = FALSE, ...)

Arguments

x

A NestedScale.

row.names, optional

Ignored (S3 signature compatibility).

...

Ignored.

Value

A data.frame: one row per atom, with the frame columns plus any weight columns.

Examples

head(scale_leaftable(scale_example()))
#>   sector class group unit size count
#> 1      P    G1    G1   U1  100    10
#> 2      P    G1    G1   U2  200    90
#> 3      P    G2    GB   U3  300    30
#> 4      P    G2    GB   U4  400    70
#> 5      S    S1    GB   U5  500    50
#> 6      S    S1    GC   U6  600    50
head(as.data.frame(scale_example()))
#>   sector class group unit size count
#> 1      P    G1    G1   U1  100    10
#> 2      P    G1    G1   U2  200    90
#> 3      P    G2    GB   U3  300    30
#> 4      P    G2    GB   U4  400    70
#> 5      S    S1    GB   U5  500    50
#> 6      S    S1    GC   U6  600    50