-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
why the order of columns changed after setting ref_groups #707
Comments
This is intentional (ie "its a feature"). The reasoning is that I didn't (and don't) think having a reference/control group appear in the middle of the list of facets doesn't make sense from a table-reading perspective. In light of this, Note, though, that like virtually all aspects of faceting, you can (should be able to) forcibly override this with a custom split function. In this case you'd use the postprocessing portion of |
Hi @gmbecker , I was wondering if there is an example for " postprocessing portion of make_split_fun to reorder the facets once they are created." maybe we could have a vignette for this too? |
@shajoezhu the example in |
reorder_facets <- function(splret, spl, fulldf, ...) {
# browser() if you enter here the order of splret seems already correct
ord <- order(names(splret$values))
make_split_result(splret$values[ord],
splret$datasplit[ord],
splret$labels[ord])
}
basic_table() %>%
split_cols_by("Species", ref_group = "virginica", split_fun = make_split_fun(post = list(reorder_facets))) %>%
analyze("Sepal.Length") %>%
build_table(iris) and I get the following:
The warning is duplicated for the duplicated split. I do not know why the order of the split in the split function seems identical to this second output before sorting and I do not know why the warning fires up |
@shajoezhu I believe this issue can be closed as wontfix afterthe above pull request is merged in to get rid of the superfluous warning. |
in the following example, the ref_group is always put in the left-most column.
This means that if we want to have consistent output, we have to put placebo arm in the left. This should be re-considered to provide the flexibility
The text was updated successfully, but these errors were encountered: