我在Mac上运行file.show()
in RStudio,如下所示:
filename <- "/Users/me/reports/myfile.pdf" # replace with file location/name
file.show(file.path(filename), title="My File")
这做了两件事:
返回:
"/usr/bin/open"
我怎样才能阻止(2)的发生?
发布于 2013-05-10 13:22:24
如果您想简单地通过Mac上的RStudio打开PDF文件,最简单的方法(据我所知)是使用system
函数:
filename <- "/Users/me/reports/myfile.pdf"
pdf <- getOption("pdfviewer") # same as options()$pdfviewer
cmd <- paste(pdf,filename)
system(cmd)
例如,它被openPDF
在生物基地中使用(参见这里)
我不知道如何改变file.show
行为,以防止在RStudio中打开空白文件。我认为这与The R.app Mac OS X GUI uses its internal pager irrespective of the setting of pager.
有关,您可以在手动这里上看到它。
注意:它在Windows机器上是不同的,直接使用shell.exec(filename)
。
https://stackoverflow.com/questions/16449783
复制相似问题