2

I want to build a basic flowchart with the DiagrammeR package like below. The code chunk below works normally. But when I add "." or "=" then I get

Error: syntax error in line 9 near '->'

working code

library(DiagrammeR)

# A minimal plot
DiagrammeR::grViz("digraph {

                  graph[layout = dot, rankdir = LR]

                  BARI_POP4_5_PRIMARY_CN
                  12
                  ACR50

                  BARI_POP4_5_PRIMARY_CN -> 12 -> ACR50
                  }")

non-working code

library(DiagrammeR)

# A minimal plot
DiagrammeR::grViz("digraph {

                  graph[layout = dot, rankdir = LR]

                  population=BARI_POP4_5_PRIMARY_CN.csv
                  12
                  ACR50

                  population=BARI_POP4_5_PRIMARY_CN.csv -> 12 -> ACR50
                  }")

The result should be like: enter image description here but with population=BARI_POP4_5_PRIMARY_CN.csv,12,ACR50 in the positions of a, b and c respectively.

firmo23
  • 7,490
  • 2
  • 38
  • 114
  • 1
    You don't use equal signs in diagrammer canonical syntax. Use population=['text'] I'm not on my computer so can't provide a detailed answer. – NelsonGon Jan 16 '19 at 20:22
  • In which of the two 'population=BARI_POP4_5_PRIMARY_CN.csv'? – firmo23 Jan 16 '19 at 20:33
  • Could you explain what these arrows are implying? Also are these node labels? If yes, why have two populations? – NelsonGon Jan 16 '19 at 20:34
  • I followed exactly the 1st example here https://mikeyharper.uk/flowcharts-in-r-using-diagrammer/ – firmo23 Jan 16 '19 at 20:37

1 Answers1

1

Does this work for you? Shapes can be modified later

      library(DiagrammeR)
grViz(
  "digraph{
    graph[layout='dot',outputorder=edgesfirst,overlap=T,rankdir=LR]

 b[label='population=BARI_POP4_5_PRIMARY_CN.csv']
 c [label='12']
 d[label='ACR50']
 b->c[label='link1']
 c->d[label='link2']
 }")

Currently: enter image description here

Shape Changes: Appears nicer

grViz(
  "digraph{
    graph[layout='dot',outputorder=edgesfirst,overlap=T,rankdir=LR]
    node[shape='box']

 b[label='population=BARI_POP4_5_PRIMARY_CN.csv']
 c [label='12']
 d[label='ACR50']
 b->c[label='link1']
 c->d[label='link2']
 }")

enter image description here

NelsonGon
  • 13,015
  • 7
  • 27
  • 57