简体   繁体   English

如何使用 R 中的元 package 更改森林 plot 中子组的顺序?

[英]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.

相关问题 使用R中的metafor包进行荟萃分析时,如何分割长森林图? - How can I split a long forest plot when meta-analyzing with the metafor package in R? 在将 byvar 指定为不同的东西后,我可以使用研究年在森林图中排列我的研究标签吗? (元包-R) - Can I arrange my study labels in a forest plot using study years after specifying the byvar to be something different? (Meta package-R) 如何绘制从使用R中的“插入符”包创建的随机森林中选择的树 - How can I plot a tree selected from the random forest created using “caret” package in R R - 如何使用 metafor package plot 森林 plot? - R - How to plot forest plot using metafor package? 如何在metafor中为森林图制作两个子组? - How do I make two subgroups for forest plot in metafor? 使用meta,metaprop和forest在R中创建林图图形 - Using meta, metaprop, and forest to create forest plot graphics in R 荟萃分析:使用荟萃套件进行汇总估算的森林图 - Meta-analysis: Forest plot of summary estimates using meta package R:使用metafor软件包在荟萃分析的森林图中加下划线 - R: underscore letters in forest plot of meta-analysis using the metafor package 在林地上方的定位标题(R-meta包) - Positioning title above forest plot (R - meta package) 如何在metafor R-package中将tau ^ 2添加到Forest Plot中? - How can I add tau^2 to Forest Plot in metafor R-package?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM