RankingProject (version 0.2.0)

RankPlotWithTable: Figure containing aligned table and plot of ranking data.

Description

RankPlotWithTable aligns a table of ranking data with a plot of the data, in one combined figure. See RankTable and RankPlot for details about the default table and plot functions, including arguments that can be passed to those functions.

Usage

RankPlotWithTable(
  tableParList,
  plotParList,
  tableFunction = RankTable,
  plotFunction = RankPlot,
  tableWidthProp = 3/8,
  tikzText = FALSE,
  annotRefName = NULL,
  annotRefRank = NULL,
  annotX = 0
)

Arguments

tableParList

A required named list of arguments that will be passed to tableFunction using do.call(). The default tableFunction is RankTable, which requires at least these four arguments: ranks, names, est, se.

plotParList

A required named list of arguments that will be passed to plotFunction using do.call(). The default plotFunction is RankPlot, which requires at least these three arguments: est, se, names.

tableFunction

The function to use for plotting a table of the data on the left-hand side of the layout. Default is RankTable.

plotFunction

The function to use for plotting a figure of the data on the right-hand side of the layout. Default is RankPlot.

tableWidthProp

A number between 0 and 1, for what proportion of the layout's width should be used to plot the table. The remaining proportion 1-tableWidthProp is used to plot the figure.

tikzText

Logical, formats text for tikz plotting if TRUE.

annotRefName, annotRefRank

Optional rank and name of the reference area, for adding an extra annotation below the figure created by plotFunction. Currently centered at 0 on x-axis, so only useful when plotType = "difference". If provided, the list must contain two required named elements (refFullName and refRank, the reference area's name and rank)

annotX

A number, showing where on the x-axis to center the annotation if annotRefName and annotRefRank are not NULL.

Details

Users may write their own table and plot functions to swap into tableFunction and plotFunction. Be aware that RankPlotWithTable uses layout to arrange the table and plot side-by-side, so layout cannot be used within either tableFunction or plotFunction. This can also cause trouble for using the lattice package within plotFunction.

See Also

RankPlot and RankTable.

Examples

Run this code
# NOT RUN {
# Table with plot of individual 90% confidence intervals
# for US states' mean travel times to work, from the 2011 ACS
data(TravelTime2011)
tableParList <- with(TravelTime2011,
  list(ranks = Rank, names = State,
       est = Estimate.2dec, se = SE.2dec,
       placeType = "State"))
plotParList <- with(TravelTime2011,
  list(est = Estimate.2dec, se = SE.2dec,
       names = Abbreviation,
       confLevel = .90, plotType = "individual", cex = 0.6))
RankPlotWithTable(tableParList = tableParList,
  plotParList = plotParList)

# Illustrating the use of annotRefName and annotRefRank:
# Table with plot of 90% confidence intervals for differences
# between each state and Colorado, with demi-Bonferroni correction
plotParList$plotType <- "difference"
plotParList$refName <- "CO"
RankPlotWithTable(tableParList = tableParList,
  plotParList = plotParList, annotRefName = "Colorado",
  annotRefRank = TravelTime2011$Rank[which(TravelTime2011$Abbreviation == "CO")])
# }

Run the code above in your browser using DataLab