0

I've got a large dataset with multiple, asynchronous measurements of labvalues, and I can't figure out how to to visualize these through individual lines, scatter plots, and a scatter plot with logistic regression lines.

Also, I want to lable patiens from categories, so i cant simply create new columns of lab_moment1 - lab_moment3 for the X and values1 - 3 for the Y.

So I want to visualize all the xy coordinates of the labmoments and values in one scatter plot, whilst preserving the patient categories.


Dataset:

ID Mutation    Lab_moment1  Lab_moment2   Lab_moment3   Lab_value1    Lab_value2     Lab_value3 
1   1           4            6             11            0.9           0.1             0.7    
2   2           2            3             12            1.9           0.2             0.15     
3   1           10           15            19            0.13          0.4             0.25   
4   3           9            11            20            0.7           0.83            0.5    
5   3           1            6             11            1.1           0.2             2.3   
tjebo
  • 21,977
  • 7
  • 58
  • 94
hendrik
  • 23
  • 3
  • Does this answer your question? [How to plot all the columns of a data frame in R](https://stackoverflow.com/questions/4877357/how-to-plot-all-the-columns-of-a-data-frame-in-r) – tjebo Nov 19 '20 at 16:37

1 Answers1

0

Solved it myself by converting the dataset to Long format. You can then simply input a single x and y, R will recognize the ID's itself and plot it using the geom_point() and geom_smooth()

hendrik
  • 23
  • 3
  • well done finding the solution. I marked your question as a duplicate, but that does not mean that you need to delete it. Keep it, so search engines may be more likely to find a good thread for their similar question. – tjebo Nov 19 '20 at 16:38