Sometimes I have very heavy plots in a device in my R session. When, for instance, I change the size of the window where the device is pointing to it gets redrawn quite slowly. Typing Ctrl+C does not seem to kill the plotting task.
有时我在R阶段的设备中有很重的情节。例如,当我改变设备指向它的窗口的大小时,重新绘制速度会很慢。键入Ctrl+C似乎不会终止绘图任务。
Is there a way of "cancelling" or killing a plot in R while it is being drawn?
是否有一种方法可以“取消”或杀死正在绘制的R中的阴谋?
Edit: I am using Linux and just the normal R shell from a terminal (gnome-terminal usually). Regardless of what system I use I guess there can be many answers covering each system or an integrative answer which shows how to perform this operation on any system.
编辑:我使用的是Linux和普通的来自终端(通常是gnome-terminal)的R shell。不管我使用什么系统,我猜可能会有很多答案覆盖每个系统或一个综合的答案,它显示了如何在任何系统上执行这个操作。
1 个解决方案
#1
2
there is a kill function in package fork http://cran.r-project.org/web/packages/fork/index.html
在package fork http://cran.r project.org/web/packages/fork/index.html中有一个kill函数
Now since R doesn't spawn a seperate gnuplot process or smth that you can kill i think you will be able to send a SIGINT to the actual R process to stop the computation. so INT is usually 2 on unices and you want to send a kill -2 to the PID of the R process.
既然R没有生成一个单独的gnuplot进程或者smth,你可以杀死它,我认为你可以向实际的R进程发送一个SIGINT函数来停止计算。所以INT在unices上通常是2你想把kill -2发送给R进程的PID。
the bad way to do that would be through a
不好的做法是通过a
system('pkill -2 R')
系统(pkill 2 R)
:) cheers
:)干杯
#1
2
there is a kill function in package fork http://cran.r-project.org/web/packages/fork/index.html
在package fork http://cran.r project.org/web/packages/fork/index.html中有一个kill函数
Now since R doesn't spawn a seperate gnuplot process or smth that you can kill i think you will be able to send a SIGINT to the actual R process to stop the computation. so INT is usually 2 on unices and you want to send a kill -2 to the PID of the R process.
既然R没有生成一个单独的gnuplot进程或者smth,你可以杀死它,我认为你可以向实际的R进程发送一个SIGINT函数来停止计算。所以INT在unices上通常是2你想把kill -2发送给R进程的PID。
the bad way to do that would be through a
不好的做法是通过a
system('pkill -2 R')
系统(pkill 2 R)
:) cheers
:)干杯