Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Metafor forest plot for subgroup analysis: how to order studies for each subgroup?

I simply organized my codes according to https://www.metafor-project.org/doku.php/plots:forest_plot_with_subgroups, where the order is predefined in "forest()" as the level of groups (order for group level, but not for subgroups), and the default order for each subgroup is reversed alphabetic. However, I'd like to sort subgroups in an order of publication year.

I tried to use the function order to give a second like "order = order (group level, year)", but did not work. So, it would be really appreciated if someone here can help. :)

like image 506
Longc Avatar asked Oct 15 '25 09:10

Longc


1 Answers

We could use order:

Add this line dat <- dat[order(dat$alloc, 3000-dat$year),]

straight after dat <- dat.bcg in your linked workflow.

This will sort the papers by increasing year:

enter image description here

like image 125
TarJae Avatar answered Oct 17 '25 02:10

TarJae