Skip to content

Instantly share code, notes, and snippets.

@gre
Last active August 29, 2015 14:22
Show Gist options
  • Save gre/86f9bf0e55a24e00fb8e to your computer and use it in GitHub Desktop.
Save gre/86f9bf0e55a24e00fb8e to your computer and use it in GitHub Desktop.
A R lang script to generate SVGs of all graphs/*.r
# requirement: r
# on MacOS: install r with homebrew: http://stackoverflow.com/a/26457411/343892
cd ./graphs/ || exit 1;
for f in *.r; do
rcode=`cat $f`
name=${f%.*}
echo -e "svg('$name.svg')\n$rcode\ndev.off()" | r --vanilla 1> /dev/null || exit 1
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment