Re: [R] lattice and several groups

2006-09-03 Thread Laurent Rhelp
Gabor Grothendieck a écrit : > Try this version which corresponds to your latest version > but makes use of panel.groups distinguishing the groups > using group.number: > > # set custom col and pch here > my.col <- 1:nlevels(df$f2) > my.pch <- 1:nlevels(df$f1) > > pnl <- function(x, y, subscripts,

Re: [R] lattice and several groups

2006-09-03 Thread Gabor Grothendieck
Try this version which corresponds to your latest version but makes use of panel.groups distinguishing the groups using group.number: # set custom col and pch here my.col <- 1:nlevels(df$f2) my.pch <- 1:nlevels(df$f1) pnl <- function(x, y, subscripts, pch, group.number, ...) { panel <- c(panel.

Re: [R] lattice and several groups

2006-09-03 Thread Laurent Rhelp
Gabor Grothendieck a écrit : > In thinking about this a bit more we can use > panel.superpose/panel.groups to shorten it: > > # define data -- df > > # note that your val2 and val3 lines had a syntax > # so we have commented them out and > # replaced them as shown. > n <- 18 > x1 <- seq(1,n) > val

Re: [R] lattice and several groups

2006-08-30 Thread Gabor Grothendieck
In thinking about this a bit more we can use panel.superpose/panel.groups to shorten it: # define data -- df # note that your val2 and val3 lines had a syntax # so we have commented them out and # replaced them as shown. n <- 18 x1 <- seq(1,n) val1 <- -2*x1+50 # val2 <- (-2*(x1-8)2)+100 val2 <- (

Re: [R] lattice and several groups

2006-08-30 Thread Gabor Grothendieck
Or maybe this is what you are looking for where pnl below was created by modifying source to the panel.plot.default in the zoo package (there might be a simpler way): pnl <- function (x, y, subscripts, groups, col, pch, type, ...) { for (g in levels(groups)) { idx <- g == groups[subsc

Re: [R] lattice and several groups

2006-08-30 Thread Gabor Grothendieck
To handle conditioning on survey we provide a panel function that subsets col and pch: # define test data - df # note that your val2 and val3 lines had a syntax # so we have commented them out and # replaced them as shown. n <- 18 x1 <- seq(1,n) val1 <- -2*x1+50 # val2 <- (-2*(x1-8)2)+100 val2 <-

Re: [R] lattice and several groups

2006-08-30 Thread hadley wickham
> 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 does

Re: [R] lattice and several groups

2006-08-30 Thread Laurent Rhelp
Gabor Grothendieck a écrit : >Note that before entering this you need: > >library(lattice) >library(grid) # to access the viewport function > >On 8/29/06, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > > >>Try this: >> >>xyplot(val ~ x, data = df, type = "p", >> col = as.numeric(df$f1), p

Re: [R] lattice and several groups

2006-08-30 Thread Laurent Rhelp
Gabor Grothendieck a écrit : > Try this: > > xyplot(val ~ x, data = df, type = "p", > col = as.numeric(df$f1), pch = as.numeric(df$f2)) > > key1 <- list(border = TRUE, colums = 2, text = list(levels(df$f1)), > points = list(pch = 1:nlevels(df$f1)) > ) > > key2 <- list(border = TRUE, colums

Re: [R] lattice and several groups

2006-08-30 Thread Laurent Rhelp
hadley wickham a écrit : >> I would like to use the lattice library to show several groups on >> the same graph. Here's my example : >> >> ## the data >> f1 <- factor(c("mod1","mod2","mod3"),levels=c("mod1","mod2","mod3")) >> f1 <- rep(f1,3) >> f2 <- factor(rep(c("g1","g2","g3"),each=3),level

Re: [R] lattice and several groups

2006-08-29 Thread Gabor Grothendieck
Note that before entering this you need: library(lattice) library(grid) # to access the viewport function On 8/29/06, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try this: > > xyplot(val ~ x, data = df, type = "p", >col = as.numeric(df$f1), pch = as.numeric(df$f2)) > > key1 <- list(bo

Re: [R] lattice and several groups

2006-08-29 Thread Gabor Grothendieck
Try this: xyplot(val ~ x, data = df, type = "p", col = as.numeric(df$f1), pch = as.numeric(df$f2)) key1 <- list(border = TRUE, colums = 2, text = list(levels(df$f1)), points = list(pch = 1:nlevels(df$f1)) ) key2 <- list(border = TRUE, colums = 2, text = list(levels(df$f2)),

Re: [R] lattice and several groups

2006-08-29 Thread hadley wickham
> I would like to use the lattice library to show several groups on > the same graph. Here's my example : > > ## the data > f1 <- factor(c("mod1","mod2","mod3"),levels=c("mod1","mod2","mod3")) > f1 <- rep(f1,3) > f2 <- factor(rep(c("g1","g2","g3"),each=3),levels=c("g1","g2","g3")) > df <- data

[R] lattice and several groups

2006-08-29 Thread Laurent Rhelp
Dear R-list, I would like to use the lattice library to show several groups on the same graph. Here's my example : ## the data f1 <- factor(c("mod1","mod2","mod3"),levels=c("mod1","mod2","mod3")) f1 <- rep(f1,3) f2 <- factor(rep(c("g1","g2","g3"),each=3),levels=c("g1","g2","g3")) df <- data