【发布时间】:2015-07-02 00:26:20
【问题描述】:
如何使用 R 中的 pipe() 通过该管道调用 gnuplot 来绘制以下内容?
set terminal latex
set output "eg1.tex"
plot [-3.14:3.14] sin(x)
我不知道如何在 R 中使用管道。
【问题讨论】:
-
为什么不能将这些命令写入临时文件并使用
system? -
你总是可以做
system('echo \'set terminal latex; set output "eg1.tex"; plot [-3.14:3.14] sin(x)\' | gnuplot') -
@hrbrmstr 我可以,但我想知道如何使用管道。感谢您的建议,尽管这不是我的问题的意思。