Skip to contents

Function that extracts summary statistics from entire database

Usage

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)
#> Key: <node>
#>       node           LOS admissions subjects
#>     <char>    <difftime>      <int>    <int>
#>  1:    f01 5.400000 days         20       18
#>  2:    f02 5.259259 days         27       24
#>  3:    f03 4.960000 days         25       24
#>  4:    f04 4.894737 days         19       18
#>  5:    f05 5.041667 days         24       21
#>  6:    f06 5.588235 days         17       15
#>  7:    f07 5.269231 days         26       23
#>  8:    f08 5.166667 days         24       19
#>  9:    f09 6.571429 days         28       26
#> 10:    f10 5.200000 days         30       28