Open higgi13425 opened 2 months ago
With the current version of the package (0.4.0
), you should be able to control the order of groups. You have to reorder the levels of your factor and fc_split()
will preserve that order. For example, taking the iris
dataset we can split by the Species
variable after rearrenging its levels:
library(flowchart)
library(dplyr)
iris <- iris |>
mutate(
Species = factor(Species, levels = c("versicolor", "setosa", "virginica"))
)
iris |>
as_fc() |>
fc_split(Species) |>
fc_draw()
Thank you for the post!
this does work for fc_draw, but the ids of the underlying boxes stay the same. Not a huge problem, but surprising when you inspect the fc object. Is there a way to make the fc object ids correspond to the correct boxes?
I am not sure if I'm understanding correctly. The ids of the boxes in the flowchart should get rearranged as well. This is the output I get when inspecting the $fc
element created with the previous code:
You can see how the ids follow the new order specified: versicolor
, setosa
and virginica
. I'm guessing it might be a problem of using a previous version of the package? I'm using the current version 0.4.0
.
I tried making group into an ordered factor - but this made the viewport unhappy. Is there a way to control the order of groups? right now these appear alphabetical