R 荟萃分析流程图

R 荟萃分析流程图,r,graphviz,diagrammer,mermaid,R,Graphviz,Diagrammer,Mermaid,是否可以使用任何R工具重现下图中的荟萃分析类型的流程图? 我尝试使用的是美人鱼: diagram = " graph LR subgraph Screening b1-->b2 end subgraph Eligibility c1-->c2 end subgraph Included d1-->d2 end subgraph Identification a1-->a2 end " mermaid(di

是否可以使用任何R工具重现下图中的荟萃分析类型的流程图?

我尝试使用的是美人鱼:

diagram = "
graph LR
  subgraph Screening
    b1-->b2
end
  subgraph Eligibility
    c1-->c2
  end
  subgraph Included
    d1-->d2
  end
  subgraph Identification
    a1-->a2
  end



"
mermaid(diagram)
这产生了:

但是我找不到一种方法来连接子图中的节点


还有其他更适合这种工作的工具吗?我正在考虑从我的Rmarkdown文档中使用的任何软件包。

我发现DiagrammeR软件包最容易做到这一点。总体思路如下:

library(glue)
library(DiagrammeR)

excluded <- glue('Full text articles excluded
             n = 1000
             Reasons for exclusion
             Reason 1
             Reason 2')
grViz("
digraph cohort_flow_chart
{
node [fontname = Helvetica, fontsize = 12, shape = box, width = 4]
a[label = 'Records identified in original search']
b[label = 'Records identified with update']
c[label = 'Records after duplicates removed']
d[label = 'Records screened']
e[label = 'Records excluded']
f[label = 'Full text articles assessed']
g[label = 'Studies included']
h[label = '@@1']



{ rank = same; a b}
{ rank = same; d, e}
{ rank = same; f, h}

a -> c;
b -> c;
c -> d;
d -> e [ minlen = 3 ];
d -> f;
f -> h [ minlen = 3 ];
f -> g;
}

[1]: excluded
")

我发现DiagrammeR包最容易做到这一点。总体思路如下:

library(glue)
library(DiagrammeR)

excluded <- glue('Full text articles excluded
             n = 1000
             Reasons for exclusion
             Reason 1
             Reason 2')
grViz("
digraph cohort_flow_chart
{
node [fontname = Helvetica, fontsize = 12, shape = box, width = 4]
a[label = 'Records identified in original search']
b[label = 'Records identified with update']
c[label = 'Records after duplicates removed']
d[label = 'Records screened']
e[label = 'Records excluded']
f[label = 'Full text articles assessed']
g[label = 'Studies included']
h[label = '@@1']



{ rank = same; a b}
{ rank = same; d, e}
{ rank = same; f, h}

a -> c;
b -> c;
c -> d;
d -> e [ minlen = 3 ];
d -> f;
f -> h [ minlen = 3 ];
f -> g;
}

[1]: excluded
")

非常感谢,这就是答案。是否可以添加垂直标签来标记从标识到包含的不同阶段?您当然可以添加标签,但不确定是否可以使用grViz功能使其垂直。编辑答案以包含水平标签。如果需要,还可以移动排除的框。我不确定grViz是否有一种简单的方法可以更好地对齐“通过更新识别的记录”框。非常感谢,这就是答案。是否可以添加垂直标签来标记从标识到包含的不同阶段?您当然可以添加标签,但不确定是否可以使用grViz功能使其垂直。编辑答案以包含水平标签。如果需要,还可以移动排除的框。不确定grViz是否有一种简单的方法可以更好地对齐“通过更新识别的记录”框。