Hi, I'm very new to R and having some difficulty managing my data.
I'm trying to track neutrophils crossing a membrane in the Z-plane and I want to display this graphically (x = time, y = position in Z-plane). My cell tracking software tracks many cells at once and outputs a table with all the tracking IDs (TID) in the 1st column with Time in the 2nd and Z-position in the 3rd. I'm tring to get R to start a new table each time the TID number changes. At the moment its plotting all the points in the table on one graph and connecting them all (as you can see in the graph provided). The package I'm using is ggplot2
The data.frame. I've provided is very minimalist, but my data outputs can contain 100s of Tracking ID's which I need to individually plot.
library(ggplot2)
testdata <- data.frame(TID=numeric(0), Time..sec.=numeric(0), Z..um.=numeric(0))
testdata <- edit(testdata)
print(testdata)
#> TID Time..sec. Z..um.
#> 1 0 0 0.0
#> 2 0 120 13.8
#> 3 0 240 7.5
#> 4 0 360 7.2
#> 5 0 480 8.0
#> 6 1 0 12.9
#> 7 1 120 8.5
#> 8 1 240 8.4
#> 9 1 360 7.9
#> 10 1 480 7.8
#Plot testdata
ggplot(data = testdata, aes(x=Time..sec., y=Z..um., group=1))+
geom_line()+
geom_point()
Created on 2019-08-26 by the reprex package (v0.3.0)
Any guidance would be very much appreciated.