sudo aptitude install r-base sudo aptitude install eog
Read from stdin and send graph output to r.png, eval $1 and display r.png
function rgraph {
Rscript -e 'png("r.png")' -e 'd<-scan("stdin", quiet=TRUE)' -e $1 && eog r.png
}
echo -e "1\n1\n2\n5\n1\n" | rgraph 'hist(d)'
echo -e "1\n1\n2\n5\n1\n0.4\n" | rgraph 'summary(d)'