# 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 DataCamp Workspace