R scripts used for general coding