Here we are calling the simplified funnelslice function using various parameters.

Load the funnel library from github.

You'll need the devtools package.

devtools::install_github('gmp26/funnel')
library(funnel)
load("../data/cabg.rda") # if necessary to access cabg data
x <- cabg # cabg was created from "inst/extdata/CABG-hospitals-03.csv"

Small plots

Not so good yet!

par(cex = 0.5)
funnelslice(x, plot_title = "Slice", plot = "slice")

Plot.funnel is very fussy about the global value of cex in a way that plot.slice is not. I don't understand how cex is meant to be used in R yet.

par(cex = 1)
funnelslice(x, plot_title = "Funnel")

Larger plots

In fact we need a figure size of about 7 inches wide, 6.5 inches high for a reasonable display. There's also an issue with margins in the slice mode.

Plot.slice estimates the margin width for text labels from a character count, but this is rather unreliable when viewed in different ways (Native R plot, exported png image, rescaled etc.) Is there a way to format the hospital label text and measure the required width in advance (e.g. by finding the width of the biggest element.)

funnelslice(x, plot_title = "Slice", plot = "slice")
funnelslice(x, plot_title = "Funnel")

Lets get some test coverage...

funnelslice(x, plot_title = "Slice", plot = "slice", tails = c(0.01,0.05))
funnelslice(x, plot_title = "Funnel", tails = c(0.01,0.05))
funnelslice(x, plot_title = "Slice", plot = "slice", xlabel = "xlabel", ylabel = "ylabel")
funnelslice(x, plot_title = "Funnel", xlabel = "xlabel", ylabel = "ylabel")
funnelslice(x, plot_title = "Slice", plot = "slice",riskadj = T)
funnelslice(x, plot_title = "Funnel", riskadj = T)

Notice the failed and missing funnel plot when riskadj = T above.

funnelslice(x, plot_title = "Slice", plot = "slice", RASRplot  =  T)
funnelslice(x, plot_title = "Funnel", RASRplot  =  T)

Toggling the remaining booleans...

funnelslice(x, plot_title = "Slice", plot = "slice", mean.target = F, plot.target = T, ypercent = F)
funnelslice(x, plot_title = "Funnel", mean.target = F, plot.target = T, ypercent = F)


gmp26/funnel documentation built on May 17, 2019, 7:28 a.m.