0

i am new to R and just did my first install with Version 3.5 via cran sources on a Kubuntu 18.04 PC alongside with Rstudio server.

Now i am playing around a little by trying and looking at some examples. For a flow diagram i installed the DiagrammR package in RStudio.

But when i copy+paste examples from http://rich-iannone.github.io/DiagrammeR/graphviz_and_mermaid.html

like

grViz("
digraph boxes_and_circles {

  # a 'graph' statement
  graph [overlap = true, fontsize = 10]

  # several 'node' statements
  node [shape = box,
        fontname = Helvetica]
  A; B; C; D; E; F

  node [shape = circle,
        fixedsize = true,
        width = 0.9] // sets as circles
  1; 2; 3; 4; 5; 6; 7; 8

  # several 'edge' statements
  A->1 B->2 B->3 B->4 C->A
  1->D E->A 2->4 1->5 1->F
  E->6 4->6 5->7 6->7 3->8
}
")

it leads to

Error in grViz("\ndigraph boxes_and_circles {\n\n # a 'graph' statement\n graph [overlap = true, fontsize = 10]\n\n # several 'node' statements\n node [shape = box,\n fontname = Helvetica]\n A; B; C; D; E; F\n\n node [shape = circle,\n
fixedsize = true,\n width = 0.9] // sets as circles\n 1; 2; 3; 4; 5; 6; 7; 8\n\n # several 'edge' statements\n A->1 B->2 B->3 B->4 C->A\n 1->D E->A 2->4 1->5 1->F\n E->6 4->6 5->7 6->7 3->8\n}\n") : could not find function "grViz"

The same goes for every other example i try.

Anyone an idea how to fix this?

1 Answers1

0

Like Jay.sf stated, you should run, in the console of RStudio, this line:

library(DiagrammeR)

And once the library es loaded, your graph will work again.