revised CreateDataframe.R