I tried to plot a beeswarm plot (http://www.cbs.dtu.dk/~eklund/beeswarm/) and I got it to work and now I want to write a small R script to automate things. The input I want to give to this R script is from STDIN and I'm having trouble to get data read from STDIN.
Here is my R script:
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)
The problem I think is just how the input file was read and processed into f. Can anyone help me fix my code? Thanks very much!