I am making spaghetti plots in ggplot2. I noticed that if a person is
missing data from a middle timepoint, the line for that person is
broken. Here is a simple example:
############
samp.data <- data.frame(timevar=rep(1:5, 2),
outcome=c(10,NA,7.5,7,7,7,8,7,6,8), id=rep(c(1,2),each=5))
based <- ggplot(data=samp.data, aes(x=timevar, y=outcome, group=id, colour=id))
based + geom_line() + geom_point() + scale_colour_identity()
############
In my data, some of the points with missing data after them are rather
high so those cases are especially interesting. Is there any way to
make geom_line() or geom_path() connect points across missing data? I
am also open to the idea that it is best the way it is.
Thanks,
Josh
--
Joshua Wiley
Senior in Psychology
University of California, Riverside
http://www.joshuawiley.com/
ggplot(data=na.omit(samp.data), aes(x=timevar, y=outcome, group=id,
colour=id))+geom_line()+ geom_point() + scale_colour_identity()
2010/6/4 Joshua Wiley <jwiley...@gmail.com>:
> --
> You received this message because you are subscribed to the ggplot2 mailing list.
> Please provide a reproducible example: http://gist.github.com/270442
>
> To post: email ggp...@googlegroups.com
> To unsubscribe: email ggplot2+u...@googlegroups.com
> More options: http://groups.google.com/group/ggplot2
>
Josh