Melting two sets of columns from wide- to long-form using reshape2 [duplicate]
问题 This question already has answers here : Reshaping multiple sets of measurement columns (wide format) into single columns (long format) (7 answers) Closed 4 years ago . I am trying to add a time-varying predictor to a long-form dataframe using reshape2::melt but I was wondering if there was a faster way to do it. Here is the toy data in wide form. There are three measures of an outcome variable (session1, session2, and session3) taken at different visits/time points. The duration between