0

我有以下使用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[1]ofvariable_x <- c("population", "timepoint","endpoint")而不是“population”,例如:

b[label='variable_x[1]=BARI_POP4_5_PRIMARY_CN.csv']
4

1 回答 1

0

这是你的想法吗?

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='']
  }
于 2019-01-16T23:06:20.593 回答