Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Gabor Grothendieck
On Mon, Aug 23, 2010 at 3:58 PM, Lei Liu liu...@virginia.edu wrote: Hi there, I want to make trajectory plots for data as follows: ID      time    y 1       1       1.4 1       2       2.0 1       3       2.5 2       1.5     2.3 2       4       4.5 2       5.5     1.6 2       6      

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Gabor Grothendieck
On Mon, Aug 23, 2010 at 4:16 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Mon, Aug 23, 2010 at 3:58 PM, Lei Liu liu...@virginia.edu wrote: Hi there, I want to make trajectory plots for data as follows: ID      time    y 1       1       1.4 1       2       2.0 1       3      

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Kingsford Jones
and some more options... dat - structure(list(ID = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 2L), .Label = c(1, 2), class = factor), time = c(1, 2, 3, 1.5, 4, 5.5, 6), y = c(1.4, 2, 2.5, 2.3, 4.5, 1.6, 2)), .Names = c(ID, time, y), row.names = c(NA, -7L), class = data.frame) library(lattice)

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Stuart Luppescu
On Mon, 2010-08-23 at 15:58 -0400, Lei Liu wrote: That is, I will plot a growth curve for each subject ID, with y in the y axis, and time in the x axis. I would like to have all growth curves in the same plot. Is there a simple way in R to do it? Thanks a lot! This article, entitled,

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Kingsford Jones
Hi Lei, Hope you don't mind I'm moving this back to the list in case others may benefit. Answers below... On Mon, Aug 23, 2010 at 3:37 PM, Lei Liu liu...@virginia.edu wrote: Hi Kingsford, Thanks a lot! I got some help from my colleague by using the following code: xyplot(y~month,group=id,

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Dennis Murphy
Hi: On Mon, Aug 23, 2010 at 4:19 PM, Kingsford Jones kingsfordjo...@gmail.comwrote: Hi Lei, Hope you don't mind I'm moving this back to the list in case others may benefit. Answers below... On Mon, Aug 23, 2010 at 3:37 PM, Lei Liu liu...@virginia.edu wrote: Hi Kingsford, Thanks a

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Kingsford Jones
On Mon, Aug 23, 2010 at 6:19 PM, Dennis Murphy djmu...@gmail.com wrote: This is an excellent idea - the only snag might occur if someone wants the mean line to be thicker :) fortunately, with your lattice solution this is easily accomplished by passing a vector to lwd: i - c(1, 1, 1, 3)

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Dennis Murphy
Hi: I think it would be tough to do that in qplot(), but it's easier in ggplot(), even if you don't add the mean information to the data frame. Here's one way - use the three person data frame (call it dat1) and the mean.y data frame that you created from aggregate() without adding the factor