Closed rjake closed 6 years ago
Thanks. I am on vacation without computer access 😎 but I'll look into your question when I'm back in a week or two.
fre. 20. jul. 2018 02.21 skrev rjake notifications@github.com:
Great package here! I work on the same team as Paul from earlier requests. I would like to be able to use the an intervention variable as the facet variable and it doesn't seem to respect the scales = "free_x" argument on the left-hand side. The effect I'm looking for is similar to the freeze argument. I am building a dashboard where the user can toggle between week, month, or quarter and this would be easier than creating an if statement to find the number of data points to freeze. For the chart to have the same look on both sides, I would also like to be able to pass along space = "free_x".
I hope this is something you can implement.
cabg_month <- cabg %>% mutate(month = floor_date(date, "month"), death = as.logical(death), intervention = ifelse(year(date) < 2014, "baseline", "intervention"), n = 1)
qic(x = month, y = death, n = n, data = cabg_month, facets = ~intervention, scales = "free_x", chart = 'p')
[image: image] https://user-images.githubusercontent.com/14003618/42976152-05750bf8-8b8e-11e8-9a3f-58be017f6654.png
cabg_month %>% group_by(month, intervention) %>% summarise(death = sum(death)/sum(n)) %>% ungroup() %>% ggplot() + geom_line(aes(x = month, y = death)) + facet_grid(~intervention, scales = "free_x", space = "free_x") + scale_x_date(breaks = date_breaks("2 months"), labels = date_format("%m/%y"))
[image: image] https://user-images.githubusercontent.com/14003618/42976418-7147d1ac-8b8f-11e8-8339-d654cbf351d3.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/anhoej/qicharts2/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AEQ_xFGgOsd97dpEHnm-yUq8vCJQ0Zttks5uISKYgaJpZM4VXRtk .
Hi again
Thanks for your suggestion, which is a very good idea. The problem is that qicharts2 uses facet_wrap (which does not have the space argument) for one-dimensional faceting. I'm sure there is a solution. Any suggestions?
Kind regards Jacob
Den fre. 20. jul. 2018 kl. 02.21 skrev rjake notifications@github.com:
Great package here! I work on the same team as Paul from earlier requests. I would like to be able to use the an intervention variable as the facet variable and it doesn't seem to respect the scales = "free_x" argument on the left-hand side. The effect I'm looking for is similar to the freeze argument. I am building a dashboard where the user can toggle between week, month, or quarter and this would be easier than creating an if statement to find the number of data points to freeze. For the chart to have the same look on both sides, I would also like to be able to pass along space = "free_x".
I hope this is something you can implement.
cabg_month <- cabg %>% mutate(month = floor_date(date, "month"), death = as.logical(death), intervention = ifelse(year(date) < 2014, "baseline", "intervention"), n = 1)
qic(x = month, y = death, n = n, data = cabg_month, facets = ~intervention, scales = "free_x", chart = 'p')
[image: image] https://user-images.githubusercontent.com/14003618/42976152-05750bf8-8b8e-11e8-9a3f-58be017f6654.png
cabg_month %>% group_by(month, intervention) %>% summarise(death = sum(death)/sum(n)) %>% ungroup() %>% ggplot() + geom_line(aes(x = month, y = death)) + facet_grid(~intervention, scales = "free_x", space = "free_x") + scale_x_date(breaks = date_breaks("2 months"), labels = date_format("%m/%y"))
[image: image] https://user-images.githubusercontent.com/14003618/42976418-7147d1ac-8b8f-11e8-8339-d654cbf351d3.png
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/anhoej/qicharts2/issues/13, or mute the thread https://github.com/notifications/unsubscribe-auth/AEQ_xFGgOsd97dpEHnm-yUq8vCJQ0Zttks5uISKYgaJpZM4VXRtk .
-- Venlig hilsen Jacob Anhøj
I've been thinking. It appears to me that facets is not the best way to implement splitting of charts by pre/post periods. Facets may be arranged in different layouts, which will not serve the purpose. However, making it possible to provide the part argument with a categorical vector (data frame column) rather than a numerical vector of split points would greatly improve the usability of the part argument. If possible, the part argument should accept both types of argument. I'll look into that.
I didn't had time to sketch anything out. Sometimes my team uses a return_dataframe = T
argument and creates spc plots from the output to use with our particular formatting, highcharter, etc. I'm not sure if that argument is something we built or if it is native to your library but I use it often. Lately I've been using the facet
argument to return the dataframe and plot my centerline shifts in an unfacetted plot. The result looks seamless. It's nice to pass multiple intervention dates in a single column to recalculate these metrics. I'm happy to talk more if you're interested.
Great package here! I work on the same team as Paul from earlier requests. I would like to be able to use an
intervention
variable as the facet variable and it doesn't seem to respect thescales = "free_x"
argument on the left-hand side. The effect I'm looking for is similar to thefreeze
argument. I am building a dashboard where the user can toggle between week, month, or quarter and this would be easier than creating an if statement to find the number of data points to freeze. For the chart to have the same look on both sides, I would also like to be able to pass alongspace = "free_x"
.I hope this is something you can implement.