Update R/calculate_intensity.R : change error() function to stop() function

Change error() function, which is not a valid function, to stop() function