Skip to contents

Pretty-print method for morie_tps_result objects.

Usage

# S3 method for class 'morie_tps_result'
print(x, ...)

Arguments

x

A morie_tps_result list.

...

Ignored.

Value

x, invisibly.

Examples

# \donttest{
set.seed(1)
df <- data.frame(OCC_YEAR = rep(2014:2023, each = 30),
                 OCC_MONTH = sample(month.name, 300, TRUE),
                 HOOD_158 = sample(sprintf("%03d", 1:20), 300, TRUE),
                 LAT_WGS84 = runif(300, 43.6, 43.8),
                 LONG_WGS84 = runif(300, -79.5, -79.2))
dfs <- list(a = df, b = df)
res <- try(morie_tps_composite_index(dfs))
if (!inherits(res, "try-error")) str(res, max.level = 1)
#> List of 8
#>  $ title         : chr "TPS -- composite crime-risk index per neighbourhood"
#>  $ call          : chr "morie_tps_composite_index(dfs)"
#>  $ summary_lines :List of 5
#>  $ tables        :List of 2
#>  $ warnings      : chr(0) 
#>  $ interpretation: chr "Composite is the unweighted (or weighted) sum of z-standardised counts across all loaded TPS categories.  Posit"| __truncated__
#>  $ payload       :List of 4
#>  $ sections      : list()
#>  - attr(*, "class")= chr [1:3] "morie_tps_result" "morie_rich_result" "list"
print(res)
#> TPS -- composite crime-risk index per neighbourhood
#> ===================================================
#> Call: morie_tps_composite_index(dfs) 
#> 
#>   Categories used        2
#>   Neighbourhoods scored  20
#>   Mean weight            1
#>   Mean composite         0
#>   Max composite          3.31
#> 
#> Top 25 neighbourhoods (highest composite):
#>   HOOD_158  Composite z-sum
#>   005  3.31
#>   019  2.364
#>   020  2.364
#>   013  1.891
#>   001  1.418
#>   004  1.418
#>   016  1.418
#>   002  0.946
#>   006  0.946
#>   017  0.946
#>   008  0
#>   003  -0.473
#>   015  -0.473
#>   011  -0.946
#>   014  -1.418
#>   009  -2.364
#>   012  -2.364
#>   007  -2.837
#>   018  -2.837
#>   010  -3.31
#> 
#> Bottom 25 neighbourhoods (lowest composite):
#>   HOOD_158  Composite z-sum
#>   010  -3.31
#>   018  -2.837
#>   007  -2.837
#>   012  -2.364
#>   009  -2.364
#>   014  -1.418
#>   011  -0.946
#>   015  -0.473
#>   003  -0.473
#>   008  0
#>   017  0.946
#>   006  0.946
#>   002  0.946
#>   016  1.418
#>   004  1.418
#>   001  1.418
#>   013  1.891
#>   020  2.364
#>   019  2.364
#>   005  3.31
#> 
#> Composite is the unweighted (or weighted) sum of z-standardised counts across all loaded TPS categories.  Positive = neighbourhood with elevated incidence across the included crime types; near-zero = average; negative = below-average exposure across categories. 
# }