Skip to content

Instantly share code, notes, and snippets.

@jplindstrom
Last active August 29, 2015 14:16
Show Gist options
  • Save jplindstrom/e1d18058047c3a309f95 to your computer and use it in GitHub Desktop.
Save jplindstrom/e1d18058047c3a309f95 to your computer and use it in GitHub Desktop.
R script graph

Install r and eog

sudo aptitude install r-base sudo aptitude install eog

Usage

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
}

Example

echo -e "1\n1\n2\n5\n1\n" | rgraph 'hist(d)'
echo -e "1\n1\n2\n5\n1\n0.4\n" | rgraph 'summary(d)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment