Not sure whether it is a scatterplot or just a plot with 3 lines.  If it is the 
latter,

library(reshape2)

matplot(acast(my.df, TIME~ID, value.var='X'), type='l', col=1:3, ylab='X', 
xlab='TIME')
legend('bottomright', inset=.05, legend=LETTERS[1:3], pch=1, col=1:3)
A.K.

On Friday, December 5, 2014 5:45 PM, farnoosh sheikhi <farnoosh...@yahoo.com> 
wrote:



Hi Arun,

I hope you are doing well.
I have a data set as follow:
my.df <- data.frame(ID=rep(c("A","B","C"), 5), TIME=rep(1:5, each=3), X=1:5)

I would like to get a scatterplot where x axis is Time (1,2,3,4,5) and y axis 
is X, but I want to have three lines separately for each ID.
 I basically want to tack each ID over time. Is this possible?


Thanks a lot and Happy Holidays to you!

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to