[R] plotting groupedData object

Osman Al-Radi osman.al.radi at gmail.com
Tue May 2 02:13:01 CEST 2006


thank your help, here is a simulated data set

time<-c(rep(1:10,5))
y<-time+rnorm(50,5,2)
subject<-c(rep('a',10),rep('b',10),rep('c',10),rep('d',10),rep('e',10))
group<-c(rep('A',30),rep('B',20))
df<-data.frame(subject,group,time,y)
gd<-groupedData(y~time|subject,outer=~group,data=df)
plot(gd,outer=T)

this produces 2 panels with two lines for group=B, and 3 lines for
group=A. Is there a way to add another line to each panel representing
the mean at each time point or a lowess curve?

Thanks

Osman


On 5/1/06, Deepayan Sarkar <deepayan.sarkar at gmail.com> wrote:
> On 5/1/06, Osman Al-Radi <osman.al.radi at gmail.com> wrote:
> > My apologies:
> >
> > library(nlme)
> > gd<-groupedData(y~time|subject,outer=~group)
> > plot(gd, outer=T)
> >
> > this produces a pannel per group with a curve per subject
>
> For me, it produces the following:
>
> > library(nlme)
> > gd<-groupedData(y~time|subject,outer=~group)
> Error in data.frame(y = y, time = time, subject = subject, group = group) :
>         object "y" not found
>
> so your example is not reproducible :-)
>
> Feel free to use a dataset from nlme or any other standard package, or
> even simulated data, but please give something that we can run.
>
> Deepayan
>


--
Osman O. Al-Radi, MD, MSc, FRCSC
Fellow, Cardiovascular Surgery
The Hospital for Sick Children
University of Toronto, Canada




More information about the R-help mailing list