我用DiagrammeR
包创建了以下工作流程图。
library(DiagrammeR)
grViz(
"digraph{
graph[layout='dot',outputorder=edgesfirst,overlap=T,rankdir=LR]
b[label='population=BARI_POP4_5_PRIMARY_CN.csv']
c [label='timepoint=12']
d[label='endpoint=ACR50']
b->c[label='']
c->d[label='']
}")
我想知道如何在这种语法中插入variable_x <- c("population", "timepoint","endpoint")
的variable_x[1]
而不是"人口",例如:
b[label='variable_x[1]=BARI_POP4_5_PRIMARY_CN.csv']
这是你的想法吗?
variable_x <- c("population", "timepoint", "endpoint")
cat(sprintf("digraph{
graph[layout='dot',outputorder=edgesfirst,overlap=T,rankdir=LR]
b[label='%s=BARI_POP4_5_PRIMARY_CN.csv']
c [label='timepoint=12']
d[label='endpoint=ACR50']
b->c[label='']
c->d[label='']
}", variable_x[1])
)
输出:
digraph{
graph[layout='dot',outputorder=edgesfirst,overlap=T,rankdir=LR]
b[label='population=BARI_POP4_5_PRIMARY_CN.csv']
c [label='timepoint=12']
d[label='endpoint=ACR50']
b->c[label='']
c->d[label='']
}