Hello,
I have a dataset of pre and post intervention data. I have an example below. The subject id number is the "id" variable, the timepoint of 1 is the pre intervention data, and the timepoint of two is the post intervention data. We also have the group assignment (treatment or control), and then many other variables of interest. I know I am going to want to do some paired t-tests comparing the pre and post intervention data for each group and some two sample t tests comparing pre and post intervention data between the groups. To do this, I am wondering if I need to alter the format of the data so that each ID number has only one row instead of one row for timepoint 1 and 1 row for timepoint 2. Is this correct thinking? If so, how do I do this? I know to put the data for one person into one row I will need to make a T1 and T2 version for most of my variables, for example var1_T1 and var1_T2. However I have no idea how to do this. I have about 350 variables so I would like to find a shorthand way to do it. Thanks so much!
I have a dataset of pre and post intervention data. I have an example below. The subject id number is the "id" variable, the timepoint of 1 is the pre intervention data, and the timepoint of two is the post intervention data. We also have the group assignment (treatment or control), and then many other variables of interest. I know I am going to want to do some paired t-tests comparing the pre and post intervention data for each group and some two sample t tests comparing pre and post intervention data between the groups. To do this, I am wondering if I need to alter the format of the data so that each ID number has only one row instead of one row for timepoint 1 and 1 row for timepoint 2. Is this correct thinking? If so, how do I do this? I know to put the data for one person into one row I will need to make a T1 and T2 version for most of my variables, for example var1_T1 and var1_T2. However I have no idea how to do this. I have about 350 variables so I would like to find a shorthand way to do it. Thanks so much!
id | timepoint | group | All other variables |
1 | 1 | treatment | |
1 | 2 | treatment | |
2 | 1 | control | |
2 | 2 | control |