R scripts from 590AGL