create_ship | R Documentation |
Creates a ship object, which serves as a container for data and methods to generate Theseus plots for decomposing differences in rate metrics.
create_ship(
data1,
data2,
y = "y",
labels = c("Original", "Refitted"),
ylab = NULL,
digits = 3L,
text_size = 1
)
data1 |
data frame representing the first group (e.g., the baseline or "original" data). |
data2 |
data frame representing the second group (e.g., the comparison or "refitted" data). |
y |
column name specifying the outcome variable used to compute the rate
metric (default is |
labels |
character vector of length 2 giving the labels for the two
groups. The first corresponds to |
ylab |
string specifying the y-axis label for plots. If |
digits |
integer indicating the number of decimal places to use for displaying numeric values (default is 3). |
text_size |
numeric value specifying the relative size of text elements in plots (default is 1.0). |
A ShipOfTheseus object, which can be used with plot()
to create Theseus plots.
library(dplyr)
library(TheseusPlot)
data <- nycflights13::flights |>
filter(!is.na(arr_delay)) |>
mutate(on_time = arr_delay <= 0)
data1 <- data |> filter(month == 1)
data2 <- data |> filter(month == 2)
create_ship(data1, data2, y = on_time)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.