Reshaping wide to long with multiple values columns [duplicate]
问题 This question already has answers here : Reshaping multiple sets of measurement columns (wide format) into single columns (long format) (7 answers) Closed 2 years ago . I need to reshape my wide table into long format but keeping multiple fields for each record, for example: dw <- read.table(header=T, text=\' sbj f1.avg f1.sd f2.avg f2.sd blabla A 10 6 50 10 bA B 12 5 70 11 bB C 20 7 20 8 bC D 22 8 22 9 bD \') # Now I want to melt this table, keeping both AVG and SD as separate fields for