change output data format to better input for R