Function that extracts summary statistics from entire database

per_facility_summary(base, verbose = FALSE, ...)

Arguments

base

(data.table). A subject discharge database, in the form of a data.table. The data.table should have at least the following columns: sID: subjectID (character) fID: facilityID (character) Adate: admission date (date) Ddate: discharge date (date)

verbose

(boolean) print diagnostic messages. Default is TRUE.

...

other parameters passed on to internal functions

Value

a data table with one row per facility, showing mean LOS, number of subjects, and number of admissions

Examples

mydb <- create_fake_subjectDB(n_subjects = 100, n_facilities = 10)
myBase <- checkBase(mydb)
#> Checking for missing values...
#> Checking for duplicated records...
#> Removed 0 duplicates
#> Done.
per_facility_summary(myBase)
#>     node           LOS admissions subjects
#>  1:  f01 5.000000 days         34       30
#>  2:  f02 4.709677 days         31       29
#>  3:  f03 5.166667 days         24       20
#>  4:  f04 3.562500 days         16       16
#>  5:  f05 5.000000 days         36       33
#>  6:  f06 5.444444 days         18       16
#>  7:  f07 5.240000 days         25       23
#>  8:  f08 5.185185 days         27       25
#>  9:  f09 5.000000 days         21       21
#> 10:  f10 5.222222 days         27       25