funplot: Create a funnel plot

Description Usage Arguments Examples

Description

This function will return a ggplot2 object. It requires two data frames: the sample data frame and the control limit data frame. An optional sub-group variable can be present in the sample data frame for coloring the funnel plot.

Usage

1
funplot(input, fundata, byvar)

Arguments

input

A data frame of the raw data with a denominator (total) as d, and numerator (events) as n

fundata

A data frame from the fundata function which holds the control limits to be overlayed.

byvar

A subgroup variable to color the plots by (Optional). Variable name must be wrapped in quotes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#My sample data
my_data  <- data.frame(id=c('A','B','C','D','E'), n=c(2,5,10,15,18), d=c(20,20,20,20,20))

#Process sample data through fundata
my_fpdata <- fundata(my_data, alpha=0.95, alpha2=0.998, method='approximate', step=0.5)

#Use sample data and fundata to make the plot.
my_plot <- funplot(my_data, my_fpdata)

#View plot
my_plot

Example output

There were 12 warnings (use warnings() to see them)

funnelR documentation built on May 2, 2019, 2:45 a.m.