split_plot: Split and plot

View source: R/splitplot.R

split_plotR Documentation

Split and plot

Description

Split a data frame on a single factor and create a plot from each chunk. Each plot is labeled with the value of sp using ggplot2::facet_wrap(). See examples.

Usage

split_plot(df, fun, sp = get_split_col(df), labeller = label_tex, ...)

Arguments

df

Data frame to split and plot.

fun

Function to use to plot.

sp

Character name of column to split; if df is a grouped data frame, leave this argument missing and the; regardless of how this is specified, sp should name a single column split column will be determined from the groups.

labeller

A labeller to pass to ggplot2::facet_wrap(); by default, the value is printed on the strip with label_tex().

...

passed to fun

Value

A list of plots, one for each grouping in sp.

Examples


df <- pmplots_data_obs()

require(dplyr)

df %>% group_by(STUDYc) %>% split_plot(dv_pred)


metrumresearchgroup/pmplots documentation built on Oct. 15, 2024, noon