Hi Dennis

Works like a charm. It's some of the best help I have ever received.

Very thankful!

Eric

On 18/01/2010, at 19.12, Dennis Murphy wrote:

> Hi:
>
> There is a very similar example in the ggplot book by Hadley Wickham  
> (section 4.5, pp. 50-52). Here's
> one approach using ggplot:
>
> library(ggplot2)
> p <- ggplot(tolerance.pp, aes(age, tolerance, group = id)) +  
> geom_line()
> p + geom_smooth(aes(group = 1), size = 2)
>
> The second command adds a smoothing spline in blue, with twice the  
> line width as the
> individual spaghetti plots, and by default, a confidence envelope   
> around it. To get rid
> of the envelope, include se = FALSE as an argument to geom_smooth();  
> to change the
> color, add the argument colour = 'red', for example.
>
> HTH,
> Dennis
>
> On Mon, Jan 18, 2010 at 3:25 PM, Eric Fail <e...@it.dk> wrote:
> Hi Ruser
>
> I'm trying to replicate some SAS code. I have to add a spline to my  
> longitudinal spaghetti plot.
>
> I have the plot, but I can't add the spline, a overall trend line.  
> In the SAS code they use the command   'I=SM50S' and I would prefer  
> something similar. I’m using R 2.10.1 on windows XP…
>
> I have made this working example.
>
> tolerance.pp <- 
> read.table("http://www.ats.ucla.edu/stat/R/examples/alda/tolerance1_pp.txt 
> ", sep=",", header=T)
> # install.packages("lattice", dep = T)
> library(lattice)
> xyplot(tolerance ~ age, groups = id, data=tolerance.pp, type = "l")
>
> This is where I want to add a overall spline.
>
> Hope someone out there can figure this out.
>
> Thanks
>
> Eric
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to