Skip to contents

Summarizes a result of cacs_run() in a list of counts and tables of the five rates, which print.cacs_run_summary() prints.

Usage

# S3 method for class 'cacs_run_result'
summary(object, ..., breakdown = c("cross_site", "per_site", "both"))

Arguments

object

A result of cacs_run() in the long form (output = "long", the default). The list-column form gives an error.

...

Not used.

breakdown

A string choosing the rate tables that print.cacs_run_summary() shows. With "cross_site" (the default), it shows rates_breakdown, and also rates_per_site when the result has at most getOption("catchmentACS.summary_per_site_max") sites, as in print.cacs_run_result(). "per_site" shows only rates_per_site, and "both" shows both. The elements of the list do not depend on this choice.

Value

A list of class c("cacs_run_summary", "list") with the elements below, and an attribute breakdown that keeps the breakdown argument for printing.

metadata

The cacs_run_result_metadata attribute of object, or NULL if it has none: the values shown in the header of print.cacs_run_result(), the time that cacs_run() took in seconds (wall_clock_seconds), skipped_geoids, and counts of rate rows by moe_fallback_reason (moe_fallback_summary).

n_rows, n_sites, n_variables, n_drive_times

The number of rows, and the numbers of distinct values of site_id, variable, and drive_time_min.

n_tracts_summary

The five-number summary of n_tracts from stats::fivenum(): minimum, lower hinge, median, upper hinge, and maximum. Rows where n_tracts is NA, such as rate rows, are left out.

rates_breakdown

A tibble with one row for each of the five rates (variable). The columns are the unweighted mean (mean) and the standard deviation (sd) of the rate over all site and drive-time pairs, leaving out missing values, and n_NA, the number of pairs where the rate is missing. print.cacs_run_result() shows the same means and standard deviations as "Top 5 rates", under the names mean_estimate and sd_estimate. The last column of that table, n, counts all the pairs, including those where the rate is missing.

rates_per_site

A tibble of the estimates of the five rates, with one row for each site and drive time (site_id, drive_time_min).

rates_per_site_moe

The same table with each cell a string giving the estimate and its margin of error (the half-width of its confidence interval), rounded to three decimals. When object has the attribute cacs_confidence_level, the table has it as well, and cacs_summary_as_markdown() names that level in its caption.

moe_fallback_rate

The number of rows whose moe_fallback is TRUE (see cacs_run()), divided by the number of all rows.

Examples

# A bundled cacs_run() result for a 10-minute area in Birmingham, Alabama
out <- readRDS(system.file("extdata", "visual_walkthrough_fixture.rds",
                           package = "catchmentACS"))$run_result
s <- summary(out)
s
#> 
#> ── catchmentACS run summary ────────────────────────────────────────────────────
#> Generated at: 2026-05-29 17:15:15
#> Provider: osrm / car
#> Sites: 1 success / 0 failed / 1 total
#> 
#> ── Run tallies ──
#> 
#> Rows: 19
#> Sites: 1
#> Variables: 19
#> Drive-time bands: 1
#> 
#> ── n_tracts five-number summary ──
#> 
#> min=36, q1=36, median=36, q3=36, max=36
#> 
#> ── Rates breakdown (mean / sd / n_NA) ──
#> 
#> # A tibble: 5 × 4
#>   variable                    mean    sd  n_NA
#>   <chr>                      <dbl> <dbl> <int>
#> 1 labor_force_participation 0.649     NA     0
#> 2 poverty_rate              0.193     NA     0
#> 3 snap_rate                 0.112     NA     0
#> 4 ssi_rate                  0.0504    NA     0
#> 5 unemp_rate                0.0424    NA     0
#> ── Rates per site ──
#> 
#> # A tibble: 1 × 7
#>   site_id   drive_time_min poverty_rate snap_rate ssi_rate unemp_rate
#>   <chr>              <int>        <dbl>     <dbl>    <dbl>      <dbl>
#> 1 AL_BHM_01             10        0.193     0.112   0.0504     0.0424
#> # ℹ 1 more variable: labor_force_participation <dbl>
#> ── MOE fallback rate ──
#> 
#> 0% of rows fell back

# The rates with their margins of error
s$rates_per_site_moe
#> # A tibble: 1 × 7
#>   site_id   drive_time_min poverty_rate  snap_rate     ssi_rate      unemp_rate 
#>   <chr>              <int> <chr>         <chr>         <chr>         <chr>      
#> 1 AL_BHM_01             10 0.193 ± 0.024 0.112 ± 0.013 0.050 ± 0.008 0.042 ± 0.…
#> # ℹ 1 more variable: labor_force_participation <chr>