[R] calling R from a shell script and have it display graphics
brahm at alum.mit.edu
Fri Feb 13 20:33:59 CET 2004
Christophe Pallier <pallier at lscp.ehess.fr> wrote:
> I would like to call R from a shell script and have it display a series
> of graphics.
> The graphics should remain visible until the user clicks or presses a key.
One trick is to use locator(1), which waits for a mouse click on a plot.
Here's a minimal Perl script that runs R, displays a plot, and exits when the
click is detected.
eval 'exec /usr/local/bin/perl -s -S $0 "$@"'
open(SCRIPT, "| R --vanilla --slave");
print SCRIPT <<'EOF';
z <- locator(1)
-- David Brahm (brahm at alum.mit.edu)
More information about the R-help