如何从R关闭pdf文件 [英] How to close pdf file from R

查看:218
本文介绍了如何从R关闭pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何关闭R中的pdf文件?当我从R编写pdf文件时,我希望能够先将其关闭(如果打开).

How do you close a pdf file from R? When I write a pdf-file from R i would like to be able to close it first (if it is open).

我有此代码:

pdf(file="test.pdf", paper="a4")
...
dev.off()

我想在运行代码之前关闭pdf文件test.pdf

I would like to close the pdf-file test.pdf before I run the code

推荐答案

一种实现此目的的方法是杀死pdf阅读器进程.在Windows中,可以使用taskkill完成此操作,可以从R中按如下所示进行调用:

One way to achieve this is to kill the pdf reader process. In Windows, this can be done with taskkill, which can be called from R as follows:

system('taskkill /f /im AcroRd32.exe')

以上内容将杀死Acrobat Reader的所有实例.

这篇关于如何从R关闭pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆