Got function to run

Used melt() to create longform out of input data. Need to review line 170.