[R] Line plots in base graphics
baptiste.auguie at googlemail.com
Thu Apr 14 00:49:55 CEST 2011
On 14 April 2011 07:51, Hadley Wickham <hadley at rice.edu> wrote:
> Am I missing something obvious on how to draw multi-line plots in base graphics?
> In ggplot2, I can do:
It appears you've been infected with what I like to call "the Dijkstra
syndrome" [*], quoting
"The tools we use have a profound (and devious!) influence on our
thinking habits, and, therefore, on our thinking abilities."
You can probably blame ggplot2 here, messing with our minds and
spoiling us. I can't seem able to think like spreadsheets anymore
either, because of R.
> data(Oxboys, package = "nlme")
> 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?
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help