Learn R Programming

pivottabler (version 0.4.0)

qhpvt: Quickly render a basic pivot table in HTML.

Description

The qhpvt function renders a basic pivot table as a HTML widget with one line of R.

Usage

qhpvt(dataFrame, rows = NULL, columns = NULL, calculations = NULL, ...)

Arguments

dataFrame

The data frame containing the data to be summarised in the pivot table.

rows

A character vector of variable names to be plotted on the rows of the pivot table, or "=" to specify the position of the calculations.

columns

A character vector of variable names to be plotted on the columns of the pivot table, or "=" to specify the position of the calculations.

calculations

One or more summary calculations to use to calculate the values of the cells in the pivot table.

...

Additional arguments, currently format, formats, totals and/or argumentCheckMode.

Value

A HTML widget.

Examples

Run this code
# NOT RUN {
qhpvt(bhmtrains, "TOC", "TrainCategory", "n()")
qhpvt(bhmtrains, "TOC", "TrainCategory",
     c("Mean Speed"="mean(SchedSpeedMPH, na.rm=TRUE)",
       "Std Dev Speed"="sd(SchedSpeedMPH, na.rm=TRUE)"),
     formats=list("%.0f", "%.1f"),
     totals=list("TOC"="All TOCs",
       "TrainCategory"="All Categories"))
# }

Run the code above in your browser using DataLab