Can anyone please help me reshape the data (attaching file named dummy data) . This data is a three-day observation for three people, for day1, day2 and day3, on two parameters- s and t.
I have been trying to reshaped the wide format data into long data ( attaching file named dummy data). I want all the variables of one day get standardized into 'day','s', and 't' and all the variables of each day get stacked below each other as shown in output data. At the same time, the 'name' and 'id' should repeat three times for each day in the long data.
I used grep function in r to identify the position of column numbers of the variables 'day1', 'day2' and 'day3', but I am not able to do two things:
- Standard the variable names and restructure them into long data as explained above.
- Duplicate the 'name' and 'id' three times in the long data.