anhoej / qicharts2

R package: Quality improvement charts
36 stars 12 forks source link

Exclude different points for different facets #41

Closed bernatplandolit closed 1 year ago

bernatplandolit commented 1 year ago

Is there a possibility to exclude different points for different facets? For example, if I select one of the posted examples:

qic(month, n, n = days, data = hospital_infections, facets = infection ~ hospital, chart = 'u', multiply = 10000, title = 'Hospital infection rates', ylab = 'Number of infections per 10.000 risk days', xlab = 'Month')

And get this plot:

Captura de pantalla 2023-03-29 a las 21 05 01

I can define a random vector to remove points:

to_exclude <- c(1:5, 10:12)

qic(month, n, n = days, data = hospital_infections, facets = infection ~ hospital, chart = 'u', multiply = 10000, title = 'Hospital infection rates', ylab = 'Number of infections per 10.000 risk days', xlab = 'Month', exclude = to_exclude)

But then I get the numbers 1 to 5 and 10 to 12 removed from all the control charts:

Captura de pantalla 2023-03-29 a las 21 08 09

Is there a possibility or a workaround to remove different points by referring them to the original dataset? Maybe it could be added by referring to a column of the dataset having a label '1' to remove '0' to use.

anhoej commented 1 year ago

Good question. The answer i no for the time being. I might consider adding this to future versions of qicharts2 (or -3 or -4).