Transpose / reshape dataframe without “timevar” from long to wide format
问题 I have a data frame that follows the below long Pattern: Name MedName Name1 atenolol 25mg Name1 aspirin 81mg Name1 sildenafil 100mg Name2 atenolol 50mg Name2 enalapril 20mg And would like to get below (I do not care if I can get the columns to be named this way, just want the data in this format): Name medication1 medication2 medication3 Name1 atenolol 25mg aspirin 81mg sildenafil 100mg Name2 atenolol 50mg enalapril 20mg NA Through this very site I have become familiarish with the reshape