[R] Scatter plot for repeated measures
farnoosh sheikhi
farnoosh_81 at yahoo.com
Mon Dec 8 18:39:56 CET 2014
Thank you all. That was very helpful. Farnoosh
On Saturday, December 6, 2014 7:41 PM, Chel Hee Lee <chl948 at mail.usask.ca> wrote:
It seems that you would like to make a spaghetti plot (in a longitudinal
data analysis). You can use the function 'interaction.plot()'.
> with(my.df, interaction.plot(TIME, ID, X))
I hope this helps.
Chel Hee Lee
On 12/06/2014 02:24 AM, arun wrote:
>
>
> 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_81 at 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 at 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.
>
[[alternative HTML version deleted]]
More information about the R-help
mailing list