Hi all, I am a beginner with R and this is my second post in RSTudio community. I want to concentrate the data from two variables in R Studio column-wise.

My dataframe looks like this

|Subject|Group|Variable @time 1|@time 2|@time3…|

| A | 1 | --- | --- | --- |

| B | 1 | --- | --- | --- |

| C | 2 | --- | --- | --- |

| D | 2 | --- | --- | --- |

I want to collapse the time points so the average of 1 and 2 are together, 3 and 4 are together etc

I also want to find a mean for each group of subjects at each time point

Does anyone have any ideas of where to start? I thought the mutate function would work or full_join but I have got into a bit of confusion

Sorry about my formatting of this question. I really am very new to R Studio

Thank you so much for your help