# Sort subgroup title

In a meta-analysis with two subgroups (low and medium concentration). One forest analyzes color, another analyzes sensitivity.
However, in a forest, first the subgroup "low" and below it the subgroup "medium". In the other forest, the opposite is true. I would like to standardize the order of the subgroups.
I realized that it is ordering according to the alphabetical order of the studies. However, I need to order the title of the subgroup and not the studies included. How can I do this?

Without knowing anything else, I'd try specifying "low" and "medium" as an ordered factor, something like this...

``````subgroups <- factor(subgroups, levels = c("low", "medium"))
``````

Can you tell us a little more, and perhaps provide a reproducible example? Are you talkingabout a Random Forest model?

Hello, thanks for your help. Yes. I'm talking about a random forest model.
For example:
DeltaE <- metacont (n_dpoc, m_dpoc, sd_dpoc,n_cont, m_cont, sd_cont, Study, data=DeltaE, sm="MD", byvar = Concentração, predict=TRUE, comb.random = gs("comb.random"))
DeltaE
forest (DeltaE, xlim=c(-6,6), comb.random = DeltaE\$comb.random, comb.fixed = FALSE, lab.e="Low/Medium", lab.c="High",label.left="Favours High",label.right="Favours Low/Medium", predict=TRUE, test.overall.random = TRUE, test.effect.subgroup = TRUE)

But now, I want to order the order of the subgroups that "Low" appears first and then "Medium".

Thanks for sharing the code - I can tell a little bit more of what's going on. Still, if you have a chance to put together a reprex, I'd appreciate it.

I'm thinking you can do something like:

``````DeltaE\$Concentração <- factor(DeltaE\$Concentração, levels = c("Low", "Medium", "High"))
``````

Most plotting methods I know of will respect the ordering of variables if that ordering is given. I'm not 100% sure `forest` does that, but that's what I would change first.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.