I have data like:
subject Dose INF-gama week visit
A-1 3 mpk 10.2 Q3W C1D1
A-1 3 mpk 100 Q3W C1D2
A-1 3 mpk 80 Q3W C2D1
A-1 3 mpk 29.6 Q3W C2D2
A-1 6 mpk 33.6 Q6W C3D2
A-1 6 mpk 45.6 Q6W C3D3
A-1 6 mpk 38.9 Q6W C3D5
A-2 3 mpk 72.2 Q3W C1D1
A-2 6 mpk 64.6 Q6W C1D2
A-2 6 mpk 67.9 Q6W C1D3
A-2 6 mpk 78.9 Q6W C1D4
A-2 3 mpk 77.4 Q3W C2D1
A-2 10 mpk 72.6 Q10W C2D3
A-2 10 mpk 88.2 Q10W C3D1
A-3 10 mpk 79.6 Q10W C1D1
A-3 10 mpk 77.4 Q10W C1D2
A-3 6 mpk 64.6 Q6W C2D1
A-3 6 mpk 67.9 Q6W C2D2
A-4 6 mpk 78.9 Q6W C1D1
A-4 6 mpk 77.4 Q6W C1D2
A-4 10 mpk 72.6 Q10W C2D1
A-4 10 mpk 64.6 Q10W C2D2
A-4 10 mpk 67.9 Q10W C2D3
A-4 10 mpk 78.9 Q10W C2D4
A-4 10 mpk 77.4 Q10W C3D3
A-4 10 mpk 72.6 Q10W C3D5
now, i want plot it with R:
- Group the data by Dose, and keep the same dose in the same group;
- Sort by visit in the same Dose group, and require the order like C1D1, C1D2, C1D15, C2D1, not C1D1,C1D15,C1D2….;
- Make a point-line graph in the same Dose group, with the horizontal axis being the sorted visit and the vertical axis being the IFN-gama value, and the points of the same Subject are connected by lines (same color)
- I want to display the groups by Dose in the same graph, for example, the first group is 3 mpk, the second group is 6 mpk, and so on.
I have made some attempts, but I still can’t meet the requirements. How should I achieve this? I am very grateful for any suggestions or help!
1