Open chumbleycode opened 3 days ago
Thanks for the kind words!
I generally use out = "png"
, This way you can view better and zoom conveniently.
To have a more compact output you can also use code = FALSE
, you'll see the control flow but not the code chunk, sometimes it helps.
Another trick can be to use out = "html"
after setting options(flow.svg = TRUE)
. The you should be able to zoom in as much as the software you used to open html files allows you to since it'll be vectorial.
Some very big diagrams are just not rendered, and for this unfortunately I have no easy solution (the not easy solution is to manipulate the code of the function to extract some parts but it's a lot of work).
Please tell me if any of those helps!
Thanks so much for your pointers. You are a star! I have found that the code is sometimes just too long for any of these workarounds. I guess that it is hard to split such diagrams and spread them over multipel pages! I'll certainly use your package more though.
In fact the act of splitting the diagram itself is not so hard because the code in R can be converted to a nested list and we can just pick one part out, to print it as a second step, but the action of selecting the right part to extract is hard:
For the latter, just thinking out loud, maybe we could have a special comment that would extract everything under this comment until we reach an upstream branch or another special comment.
I too encountered this problem when trying this on huge base R functions (>1200 LOC).
I think that the second solution could be doable. Blocks of code are in a depth level x
(from top to bottom). One could split a graph every 5 levels, or specifically decide to focus on levels 4 to 5. This would require splitting the functionality of calculating the drawing and actually plotting it (and calculate the depth of each block). I think this would work well also internally (and could open the door to compare different versions of the same function when refactoring).
HTH
love the package! I have not had useful visualizations when applied to a very long piece of code (everything is way too small to see with the naked eye!!). Unfortunately this is where it is most useful to me. Do you have any ideas and pointers?