Can ggplot2 be used to create a plot matrix of one set of columns against another set?
For example, with the dataframe below plot all columns beginning with 'x' against all columns beginning with 'y', to produce a grid of plots.
require("tidyverse")
df <- tibble(
x1 = sample(10),
x2 = sample(10),
x3 = sample(10),
y1 = sample(10),
y2 = sample(10)
)
And what if, unlike in the example above, the columns are not named in a regular pattern - is there a way that arbitrary sets of columns can be chosen?
Thanks in advance



expand.gridfunction. It should create all 2-way combinations of an arbitrary set of 2 list names. (It's not a part of tidyverse.)