我试图绘制一个 beeswarm 图(http://www.cbs.dtu.dk/~eklund/beeswarm/),我让它工作,现在我想写一个小的 R 脚本来自动化事情。我想给这个 R 脚本的输入来自 STDIN,我无法从 STDIN 读取数据。
这是我的 R 脚本:
args <- commandArgs(TRUE)
f1 <- args[1]
plotbeeswarm <- function(output){
library(beeswarm)
f <- read.table(stdin(), header=TRUE)
png(output, width=800, height=800)
beeswarm(Data ~ Category, data=f, pch=16, pwcol=1+as.numeric(sample),
xlab="")
}
plotbeeswarm(f1)
我认为的问题是如何将输入文件读取并处理为 f. 谁能帮我修复我的代码?非常感谢!