Update run_analysis.R

added error checking