[R] lattice and several groups

hadley wickham h.wickham at gmail.com
Thu Aug 31 00:07:06 CEST 2006

> In fact, my problem is to fit the data for every level of the f2 factor,
> showing the levels of the f1 factor and that for several surveys .
> Here's an example closer to my actual data :

Then maybe you want:
qplot(x, y, . ~ surveys, data=df, type="line", colour=f1, id=f2, size=f2)

(which doesn't produce a very nice legend)

Or to build up piece by piece
p <- ggplot(df, . ~ surveys, aes=list(x=x, y=y, colour=f1, id=f2))
p <- ggline(p)
ggpoint(p, aes=list(shape=f2))

(you might want to flip shape and colour around to get what you want)


More information about the R-help mailing list