R scripts for use in Pirana and PiranaJS