Skip to contents

The one-row-per-leaf table the geoscale is built on, as a plain data.frame — the exported accessor to prefer over reaching for x@leaftable (the twin of timescales::calendar_leaftable()). as.data.frame() and ggplot2::fortify() on a GeoScale are equivalent, so ggplot(gs) + geom_*() pipelines work directly.

Usage

geoscale_leaftable(x)

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

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

# S3 method for class 'GeoScale'
fortify(model, data, ...)

Arguments

x

A GeoScale.

row.names, optional

Ignored (S3 signature compatibility).

...

Ignored.

model

A GeoScale (the fortify() generic's argument name).

data

Ignored (S3 signature compatibility).

Value

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

Examples

head(geoscale_leaftable(geoscale_example()))
#>   country state zone cell km2 pop
#> 1       N    N1   N1   A1 100  10
#> 2       N    N1   N1   A2 200  90
#> 3       N    N2   ZB   A3 300  30
#> 4       N    N2   ZB   A4 400  70
#> 5       S    S1   ZB   A5 500  50
#> 6       S    S1   ZC   A6 600  50
head(as.data.frame(geoscale_example()))
#>   country state zone cell km2 pop
#> 1       N    N1   N1   A1 100  10
#> 2       N    N1   N1   A2 200  90
#> 3       N    N2   ZB   A3 300  30
#> 4       N    N2   ZB   A4 400  70
#> 5       S    S1   ZB   A5 500  50
#> 6       S    S1   ZC   A6 600  50