Question: USE R Program and show the code with explanations Below is a dataset for 12 subjects, the 1st column is gender, the 2nd column is
USE R Program and show the code with explanations
Below is a dataset for 12 subjects, the 1st column is gender, the 2nd column is a treatment indicator (1=treatment and 0=placebo). T1, T2, and T3 are test results on 3 follow-up visits.
| ID | Sex | Treatment | T1 | T2 | T3 |
| 1 | 0 | 0 | 94 | 23 | 61 |
| 2 | 0 | 1 | 46 | 92 | 97 |
| 3 | 0 | 0 | 40 | 65 | 43 |
| 4 | 0 | 1 | 64 | 15 | 8 |
| 5 | 0 | 0 | 6 | 34 | 59 |
| 6 | 0 | 1 | 30 | 37 | 10 |
| 7 | 1 | 0 | 47 | 85 | 88 |
| 8 | 1 | 1 | 36 | 41 | 3 |
| 9 | 1 | 0 | 92 | 60 | 95 |
| 10 | 1 | 1 | 1 | 100 | 47 |
| 11 | 1 | 0 | 32 | 66 | 62 |
| 12 | 1 | 1 | 25 | 43 | 93 |
4.a Reshape the data from the wide format to long format so that the repeated measures T1, T2, and T3 are on separates rows in one variable.
4.b Create boxplots for the test results by visit by gender.
4.c Suppose larger values of test result means worse results for the patients.Test to see whether the patients' situations are different in the first test by gender.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
