Issue
When running custom code from the R tool, the followingR as shown below: Error in plot.new()
Error in plot.new()
Cause
This error may occur when using the AlteryxGraph device. The reason for this is that the AlteryxGraph device creates a pipe between Alteryx and R. If creating graphs in a loop, a pipe has to be created for each loop which slows down the processing. As a result, Alteryx ends up trying to create the next graph before the previous one is completed. To avoid this, it is best practice when creating multiple graphs within a loop to keep the AlteryxGraph device statement outside of the loop.
Solution
Below is some R coding that demonstrates the cause and resolution.
AlteryxGraph inside the loop - Results in error:
x
AlteryxGraph outside the loop - Does noterror:
x
A big thanks to @DrDanfor his explanationand code samples.