Skip to content

multiple left hand side columns #135

@ggrothendieck

Description

@ggrothendieck

Would be nice to have the lattice feature which allows multiple columns on left hand side so that wide form data frames can be directly graphed without converting to long form.

library(lattice)

xyplot(y1 + y2  ~ x1, anscombe, col = 1:2, pch = 20, cex = 2) # plots y1 and y2 in same panel

# error but would be nice if it worked in ggformula
xyplot(. ~ x1, anscombe[c("x1", "y1", "y2")], col = 1:2, pch = 20, cex = 2) 

# unravels LHS into vector but would be better if it treated LHS as 2 columns in ggformula
xyplot(cbind(y1, y2) ~ x1, anscombe, col = 1:2, pch = 20, cex = 2) 

lm(cbind(y1, y2) ~ x1, anscombe) # regresses each of y1 and y2 on x1

This doesn't work in ggformula either:

gf_line(anscombe, c(y1, y2) ~ x1)

but can be done in lattice. Here x1 is recycled.

xyplot(c(y1, y2) ~ x1, anscombe, pch = 20, cex = 2)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions