[英]How can I change the order of subgroups in a forest plot using the meta package in R?
I would like some assistance in changing the order subgroups appear in my forest plot.我需要一些帮助来更改我的森林 plot 中出现的顺序子组。 I am using the meta
package in R to perform my meta-analysis and generate my forest plot.我正在使用 R 中的meta
package 来执行我的元分析并生成我的森林 plot。 I've included some example data below.我在下面包含了一些示例数据。
mydata <- data.frame(
A = 1:9,
Ms = sample(100:500, 9),
Ss = sample(10:50, 9),
Mr = sample(100:500, 9),
Sr = sample(10:50, 9),
Ns = sample(5:50, 9),
Nr = sample(5:50, 9),
P = sample(c("foot", "tibia", "lumbar"), 9, replace = TRUE)
)
Here is some basic code used to run my meta-analysis.这是一些用于运行我的元分析的基本代码。
ma <- metacont(Ns,
Ms,
Ss,
Nr,
Mr,
Sr,
data = mydata,
byvar = P,
comb.fixed = FALSE,
comb.random = TRUE)
I use the byvar
function to run a subgroup analysis.我使用byvar
function 运行子组分析。 Here is the code I use to plot the results.这是我用于 plot 结果的代码。
forest(ma,
layout = "RevMan5",
subgroup = TRUE,
print.byvar = FALSE)
I would like the subgroups to be ordered foot, tibia and lumbar, rather than foot, lumbar and tibia (as shown in the link below).我希望子组是足部、胫骨和腰部,而不是足部、腰部和胫骨(如下面的链接所示)。 I'm stuck on how to do this and any help will be greatly appreciated.我坚持如何做到这一点,任何帮助将不胜感激。
I had to review the source code , but it looks like all you have to do is change ma$bylevs
.我不得不查看源代码,但看起来您所要做的就是更改ma$bylevs
。
ma$bylevs <- c("foot", "tibia", "lumbar")
forest(ma,
layout = "RevMan5",
subgroup = TRUE,
print.byvar = FALSE)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.