bergant / datamodelr

Data model diagrams in R
Other
285 stars 28 forks source link

Possible to add url links for columns? #11

Open reinholdsson opened 5 years ago

reinholdsson commented 5 years ago

To begin with, great work! I find this package very useful.

I would like to render a graph as a table of contents in RMarkdown, where each column links to a section within the document. Is there a simple way to solve this?

I thought of two possible solutions, but haven't figured out how to get it to work:

  1. Modify the column title, e.g. speed => <a href="www.example.com">speed<a>, but then it says Error: in label of node Master.
  2. Make use of the graphviz URL attribute, not sure though if it's possible to specify it column-wise? See example below (but with the same link for all columns):
require(datamodelr)
x <- dm_from_data_frames(cars)
x <- dm_create_graph(x, node_attrs = "URL = '#title-1'")
dm_render_graph(x)

Then it would refer to the section # My title {#title-1} in the document.

All suggestions are welcome.