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. :)
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: