completed writing addition R scripts for data import