Various R scripts for energy analysis