[R] [lattice] group by two factors

tpoisot tpoisot at um2.fr
Mon May 30 19:16:37 CEST 2011


Hi all,

I'm working on a dataframe (webs) with two variables ($size, $vspe), and two
grouping factors ($type, $mutu). I would like to do a lattice plot wherein
the levels of $mutu would be different shapes, and the levels of $type
different colors. Additionally, I'd like to add a regression line for the
two levels od $mutu only (no matter what the value of $type is).

It's super easy to do in ggplot2  :

ggplot(webs,aes(y=vspe,x=size)) + geom_point(aes(shape=mutu,colour=type)) +
geom_smooth(aes(group=mutu,linetype=mutu),method='lm',fill=NA)

However, I'm have no idea about how to do it in lattice. Does someone have
any advice?

Thanks

--
View this message in context: http://r.789695.n4.nabble.com/lattice-group-by-two-factors-tp3561201p3561201.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list