anhoej / qicharts2

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

Add a return.data argument to qic() #17

Closed pwildenhain closed 5 years ago

pwildenhain commented 5 years ago

I know you can already get the data from the plot with something like this

plot_data <- qic(...)$data

It would be quicker, especially if you only need the data to have something like this

plot_data <- qic(..., return.data = TRUE)

Returning the aggregated data.frame, without having to plot the data first.

As far as implementation, possibly placing a early return() here right before the data gets plotted, if return.data = TRUE

Looking forward to hearing your thoughts about this feature request 😄

anhoej commented 5 years ago

Thanks! I'll think about it.

On a first thought, no, because it adds nothing but a new argument to qic(), which already has too many. When using $data the plot is not printed, and anyway you would most likely assign the output to a variable anyway.