createWaterfall: Create a Waterfall Chart Using Highcharter

Description Usage Arguments Examples

View source: R/createWaterfall.R

Description

This function creates a waterfall chart using highcharter. It automatically converts entered values into percentages (percentages are calculated relative to the first value entered). It also automatically converts entered values into a series for plotting and also automatically chooses the color for a given category based on the category's value (positive or negative).

Usage

1
2
createWaterfall(dfNames, dfValues, isSum, isIntermediateSum, title, subTitle,
  xTitle, yTitle)

Arguments

dfNames

These are the names of the categories

dfValues

These are the values for each category. Intermediate and sum categories should be left as NA.

isSum

This is a boolean list of whether the names and values represent a sum in the waterfall chart.

isIntermediateSum

This is a boolean list of whether the names and values represent an intermediate sum in the waterfall chart.

title

This is the title of the chart

subTitle

This is the subtitle of the chart

xTitle

This is the title of the x axis.

yTitle

This is the title of the y axis.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
dfNames <- c("Trips where passengers paid a surcharge",
"Double counted trips (pickup AND dropoff in special venue)",
"Trips where Uber paid a surcharge and didn't charge the rider",
"Trips where the dropoff did not occur in the current month",
"'Line' trips","Trips where Uber paid a $5 fee to the city")
dfValues <- c(416468,2338,140,72,-1773,NA)
isIntermediateSum = c(0,0,0,0,0,0)
isSum = c(0,0,0,0,0,1)
output$heatmap <- highcharter::renderHighchart({
createWaterfall(dfNames, dfValues, isSum, isIntermediateSum,"Line Trip Reconciliation",
"Cumulative Effect of Adjustments","Adjustment Type","Percent Effect")
})

jsdeherrera/shinyBoots documentation built on May 20, 2019, 2:08 a.m.