Re: [R] Overlaying lattice graphs (continued)

2007-06-22 Thread hadley wickham
Yes - you'll need ggplot2. Hadley On 6/22/07, Sébastien <[EMAIL PROTECTED]> wrote: > Hadley, > > I have some troubles to run your code with ggplot version 0.4.1. Is the > package ggplot2 mandatory ? > > Sebastien > > hadley wickham a écrit : > > Hi Sebastian, > > > > I think the following does wh

Re: [R] Overlaying lattice graphs (continued)

2007-06-22 Thread Sébastien
Hadley, I have some troubles to run your code with ggplot version 0.4.1. Is the package ggplot2 mandatory ? Sebastien hadley wickham a écrit : > Hi Sebastian, > > I think the following does what you want: > > library(ggplot2) > names(mydata) <- tolower(names(mydata)) > > obs <- rename(subset(my

Re: [R] Overlaying lattice graphs (continued)

2007-06-22 Thread Deepayan Sarkar
On 6/22/07, Sébastien <[EMAIL PROTECTED]> wrote: > Hi Deepayan, > > The following code creates a dummy dataset which has the same similar as > my usual datasets. I did not try to implement the changes proposed by > Hadley, hoping that a solution can be found using the original dataset. > >

Re: [R] Overlaying lattice graphs (continued)

2007-06-22 Thread hadley wickham
Hi Sebastian, I think the following does what you want: library(ggplot2) names(mydata) <- tolower(names(mydata)) obs <- rename(subset(mydata, model=="A", -predicted), c("observed" = "value")) obs$model <- factor("observed") pred <- rename(mydata[, -5], c("predicted" = "value")) all <- rbind(obs,

Re: [R] Overlaying lattice graphs (continued)

2007-06-22 Thread Sébastien
Hi Deepayan, The following code creates a dummy dataset which has the same similar as my usual datasets. I did not try to implement the changes proposed by Hadley, hoping that a solution can be found using the original dataset. # My code # Creating dataset nPts<-10# number

Re: [R] Overlaying lattice graphs (continued)

2007-06-21 Thread Deepayan Sarkar
On 6/21/07, Sébastien <[EMAIL PROTECTED]> wrote: > Hi Hadley, > > Hopefully, my dataset won't be too hard to changed. Can I modify the > aspect of each group using your code (symbols for observed and lines for > predicted)? > > Sebastien > > hadley wickham a écrit : > > Hi Sebastian, > > > > I thin

Re: [R] Overlaying lattice graphs (continued)

2007-06-21 Thread hadley wickham
Sebastian, You should be able to, but I don't know how to do it with lattice. In ggplot (http://had.co.nz/ggplot2) you would do it as follows: ggplot(mydata, aes(x = time, y = value, colour=model)) + geom_point(subset(data, model != "observed")) + geom_line((subset(data, model == "observed")) +

Re: [R] Overlaying lattice graphs (continued)

2007-06-21 Thread Sébastien
Hi Hadley, Hopefully, my dataset won't be too hard to changed. Can I modify the aspect of each group using your code (symbols for observed and lines for predicted)? Sebastien hadley wickham a écrit : > Hi Sebastian, > > I think you need to rearrange your data a bit. Firstly, you need to > put

Re: [R] Overlaying lattice graphs (continued)

2007-06-21 Thread Sébastien
Sorry, I have forgotten to tell that I work on R version 2.5.0 on Windows XP sp2. Sébastien a écrit : > Dear R Users, > > I recently posted an email on this list about the use of data.frame and > overlaying multiple plots. Deepayan kindly indicated to me the > panel.superposition command which

Re: [R] Overlaying lattice graphs (continued)

2007-06-21 Thread hadley wickham
Hi Sebastian, I think you need to rearrange your data a bit. Firstly, you need to put observed on the same footing as the different models, so you would have a new column in your data called value (previously observed and predicted) and a new model type ("observed"). Then you could do: xyplot(v

[R] Overlaying lattice graphs (continued)

2007-06-20 Thread Sébastien
Dear R Users, I recently posted an email on this list about the use of data.frame and overlaying multiple plots. Deepayan kindly indicated to me the panel.superposition command which worked perfectly in the context of the example I gave. I'd like to go a little bit further on this topic using