How to transform row information into columns in this case