[R] Line plots in base graphics

From: Hadley Wickham <hadley_at_rice.edu>
Date: Wed, 13 Apr 2011 14:51:53 -0500


Am I missing something obvious on how to draw multi-line plots in base graphics?

In ggplot2, I can do:

data(Oxboys, package = "nlme")
library(ggplot2)

qplot(age, height, data = Oxboys, geom = "line", group = Subject)

But in base graphics, the best I can come up with is this:

with(Oxboys, plot(age, height, type = "n")) lapply(split(Oxboys[c("age", "height")], Oxboys$Subject), lines)

Am I missing something obvious?

Thanks!

Hadley

-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/

______________________________________________
R-help_at_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.
Received on Wed 13 Apr 2011 - 19:55:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 13 Apr 2011 - 20:20:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive