Open ellessenne opened 4 years ago
You are right... this could have been made nicer. I implemented your suggested changes.
I think it prints better, but I still see some inconsistencies:
> ancrt_quality <- quality_indicators(ancrt_cleaned, by_region = TRUE, by_time = FALSE)
> ancrt_quality
Raw.Count Raw.Percent Clean.Count Clean.Percent region
Missing >=1 quarter 0 (0%) NA NA all
Missing n_clients 0 (0%) 0 (0%) all
Missing n_status 0 (0%) 0 (0%) all
Missing testpos 0 (0%) 0 (0%) all
Missing testneg 0 (0%) 0 (0%) all
Missing knownpos 0 (0%) 0 (0%) all
Missing >=1 variables 0 (0%) 0 (0%) all
Invalid coverage 654 (3.27%) 650 (3.25%) all
Invalid prevalence 0 (0%) 0 (0%) all
Inconsistent n_status 475 (2.38%) 0 (0%) all
Negative n_clients 0 (0%) 0 (0%) all
Negative n_status 0 (0%) 0 (0%) all
Negative testpos 1 (0%) 0 (0%) all
Negative testneg 0 (0%) 0 (0%) all
Negative knownpos 0 (0%) 0 (0%) all
One or more invalid variables 886 (4.43%) 650 (3.25%) all
Missing >=1 quarter (region 1) 0 (0%) NA NA 1
Missing n_clients (region 1) 0 (0%) 0 (0%) 1
Missing n_status (region 1) 0 (0%) 0 (0%) 1
Missing testpos (region 1) 0 (0%) 0 (0%) 1
Missing testneg (region 1) 0 (0%) 0 (0%) 1
Missing knownpos (region 1) 0 (0%) 0 (0%) 1
Missing >=1 variables (region 1) 0 (0%) 0 (0%) 1
Invalid coverage (region 1) 229 (3.58%) 213 (3.33%) 1
Invalid prevalence (region 1) 0 (0%) 0 (0%) 1
Inconsistent n_status (region 1) 142 (2.22%) 0 (0%) 1
Negative n_clients (region 1) 0 (0%) 0 (0%) 1
Negative n_status (region 1) 0 (0%) 0 (0%) 1
Negative testpos (region 1) 0 (0%) 0 (0%) 1
Negative testneg (region 1) 0 (0%) 0 (0%) 1
Negative knownpos (region 1) 0 (0%) 0 (0%) 1
One or more invalid variables (region 1) 290 (4.53%) 213 (3.33%) 1
Missing >=1 quarter (region 3) 1 (0.46%) NA NA 2
Missing n_clients (region 3) 0 (0%) 0 (0%) 2
Missing n_status (region 3) 0 (0%) 0 (0%) 2
Missing testpos (region 3) 0 (0%) 0 (0%) 2
Missing testneg (region 3) 0 (0%) 0 (0%) 2
Missing knownpos (region 3) 0 (0%) 0 (0%) 2
Missing >=1 variables (region 3) 0 (0%) 0 (0%) 2
Invalid coverage (region 3) 142 (3.3%) 138 (3.21%) 2
Invalid prevalence (region 3) 0 (0%) 0 (0%) 2
Inconsistent n_status (region 3) 108 (2.51%) 0 (0%) 2
Negative n_clients (region 3) 0 (0%) 0 (0%) 2
Negative n_status (region 3) 0 (0%) 0 (0%) 2
Negative testpos (region 3) 0 (0%) 0 (0%) 2
Negative testneg (region 3) 0 (0%) 0 (0%) 2
Negative knownpos (region 3) 0 (0%) 0 (0%) 2
One or more invalid variables (region 3) 188 (4.37%) 138 (3.21%) 2
Missing >=1 quarter (region 2) 1 (0.22%) NA NA 3
Missing n_clients (region 2) 0 (0%) 0 (0%) 3
Missing n_status (region 2) 0 (0%) 0 (0%) 3
Missing testpos (region 2) 0 (0%) 0 (0%) 3
Missing testneg (region 2) 0 (0%) 0 (0%) 3
Missing knownpos (region 2) 0 (0%) 0 (0%) 3
Missing >=1 variables (region 2) 0 (0%) 0 (0%) 3
Invalid coverage (region 2) 283 (3.04%) 299 (3.22%) 3
Invalid prevalence (region 2) 0 (0%) 0 (0%) 3
Inconsistent n_status (region 2) 225 (2.42%) 0 (0%) 3
Negative n_clients (region 2) 0 (0%) 0 (0%) 3
Negative n_status (region 2) 0 (0%) 0 (0%) 3
Negative testpos (region 2) 1 (0.01%) 0 (0%) 3
Negative testneg (region 2) 0 (0%) 0 (0%) 3
Negative knownpos (region 2) 0 (0%) 0 (0%) 3
One or more invalid variables (region 2) 408 (4.39%) 299 (3.22%) 3
Note that region 2 and 3 are mixed up between the first and last column.
There is an inconsistence between the region and the suffix added to the quality indicators:
Here, for instance, region 3 has quality indicators with suffix
.2
. Could it be just a matter of ordering 'region' before printing the results? If so, I would suggest making sure they're ordered appropriately. It may not be wrong per se strictly speaking, but it looks like it could lead to some confusion to me.