Finished the complete function
Added corr.R