[R] Plot trajectories using ggplot?
mike at hsm.org.uk
Sat May 14 10:18:07 CEST 2016
Ive got stuck using the code below to try to plot trajectories - columns are data recorded at time points, rows are cases. Ive used melt to turn the data long allowing me to group by time point and then plot using geom_point but I now need to join the points based upon the correct case (i.e. the first row in the original dataset). geo_segment allows me to specify start-end but I need to do this over multiple time periods....
Any help much appreciated
#Read raw data
df = read.table("http://www.lecturematerials.co.uk/data/sample.csv", header=TRUE, sep=",", dec=".", na.strings=c("NA"))
#Turn data from wide to long
ggplot(ds, aes(x = variable, y = value)) +
geom_point (shape=19, size=5, fill="black")
More information about the R-help