Creates dumbbell plots to visualize changes between two measurements for the same observations. The package provides customization options for labels, colors, arrows, delta values, and paired statistical test annotations.
Load libraries
suppressPackageStartupMessages({
library(tidyverse)
library(ggplot2)
library(rlang)
library(utils)
library(data.table)
library(dumbbell)
})
Get some data: Example data taken from https://plotly.com/r/dumbbell-plots/
s % mutate("type" = 'Gender earnings disparity')
Plot
dumbbell::dumbbell(xdf=s1,id="School",key = "type", column1 = "Women", column2 = "Men", delt=1 ,arrow = 1, lab1 = "Women", lab2="Men", p_col1 = "red", p_col2 = "blue" ,pt_val = 1 , pval = 2, textsize = 3) + xlim(60,170) + facet_wrap( . ~ type)