R scripts for training lessons