in R there are several ways to wait for an input from the user, such as clicking somewhere on a graph (e.g. locator() function).

I'm looking for an option to record the user input WITHOUT waiting for it. I'm running a for loop with a locator() function in it, but this function prevents the for loop to progress unless the user click on something.

Any idea on how to overcome this?

有帮助吗?

解决方案

Your best option is probably to use another GUI toolset, tcltk is one option. You can create a plot and display it in a Tk window, then set up a handler that will change a variable value if the user clicks on the plot, then you can have your loop doing other calculations and just check periodically if the variable set by the handler has changed.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top