Thanks very much for the pointer - that was spot on. The key thing was to add
df$case <- rownames(df)
to generate the row by row case for when I melted the columns. As Ive since
found out either of these will work
ggplot(ds, aes(x = as.numeric(variable), y = value, colour = case)) +
You can introduce the row number as a case number, you can group by case
and plot the connecting lines
#Read raw data
df = read.table("http://www.lecturematerials.co.uk/data/sample.csv;,
header=TRUE, sep=",", dec=".", na.strings=c("NA"))
names(df)<-c("1","2","3","4")
df$case <- rownames(df)
Hi
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
3 matches
Mail list logo