Any tool or package to convert R code to a FlowChart diagram or vice versa?


I need to code some complex nested conditions and loops to solve a problem related with sequences of events of different types. Sometimes it gets confusing.
Is there any external tool or R package able to generate a FlowChart diagram from my code? Or able to generate R code from a diagram?