Function that extracts summary statistics from entire database

all_admissions_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 list of summary statistics: - meanLOS: The mean length of stay, in days - meanTBA: The mean time between admissions, in days - totalAdmissions: Total number of admissions (i.e. number of records in the database) - numSubjects: Number of unique subjects - numFacilities: Number of unique facilities - LOSdistribution: Distribution of length of stay - TBAdistribution: Distribution of time between 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.
all_admissions_summary(myBase)
#> $meanLOS
#> Time difference of 5.011952 days
#> 
#> $meanTBA
#> Time difference of 29.76821 days
#> 
#> $totalAdmissions
#> [1] 251
#> 
#> $numSubjects
#> [1] 100
#> 
#> $numFacilities
#> [1] 10
#> 
#> $LOSdistribution
#> LOS
#>  1  2  3  4  5  6  7  8  9 10 11 13 14 
#> 32 22 35 24 33 37 18 20 10  7 11  1  1 
#> 
#> $TBAdistribution
#> TBA
#>  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 
#>  1  2  2  1  1  1  1  3  2  2  3  5  5 10  2  4  2  3 11  8  8  8  4  1  1  8 
#> 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 56 57 
#>  3  5  7  3  3  1  4  4  3  1  1  3  4  1  1  1  1  2  1  1  1  1 
#>