The qtbl function builds a basic table with one line of R.

qtbl(
  dataFrameOrMatrix,
  columnNamesAsColumnHeaders = TRUE,
  explicitColumnHeaders = NULL,
  rowNamesAsRowHeaders = FALSE,
  firstColumnAsRowHeaders = FALSE,
  explicitRowHeaders = NULL,
  numberOfColumnsAsRowHeaders = 0,
  columnFormats = NULL,
  columnCellTypes = NULL,
  theme = NULL,
  replaceExistingStyles = FALSE,
  tableStyle = NULL,
  headingStyle = NULL,
  cellStyle = NULL,
  totalStyle = NULL,
  ...
)

Arguments

dataFrameOrMatrix

The data frame or matrix containing the data to be displayed in the table.

columnNamesAsColumnHeaders

TRUE to use the data frame column names as the column headers in the table.

explicitColumnHeaders

A character vector of column headers.

rowNamesAsRowHeaders

TRUE to use the data frame row names as the row headers in the table.

firstColumnAsRowHeaders

TRUE to use the first column in the data frame as row headings.

explicitRowHeaders

A character vector of row headers.

numberOfColumnsAsRowHeaders

The number of columns to be set as row headers.

columnFormats

A list containing format specifiers, each of which is either an sprintf() character value, a list of format() arguments or an R function that provides custom formatting logic.

columnCellTypes

A vector that is the same length as the number of columns in the data frame, where each element is one of the following values that specifies the type of cell: root, rowHeader, columnHeader, cell, total. The cellType controls the default styling that is applied to the cell. Typically only rowHeader, cell or total would be used.

theme

Either the name of a built-in theme (default, largeplain, compact or blank/none) or a list which specifies the default formatting for the table.

replaceExistingStyles

TRUE to completely replace the default styling with the specified tableStyle, headingStyle, cellStyle and/or totalStyle

tableStyle

A list of CSS style declarations that apply to the table.

headingStyle

A list of CSS style declarations that apply to the heading cells in the table.

cellStyle

A list of CSS style declarations that apply to the normal cells in the table.

totalStyle

A list of CSS style declarations that apply to the total cells in the table.

...

Additional arguments, currently compatibility and/or argumentCheckMode.

Value

A basic table.

Examples

qtbl(bhmsummary[1:5, c("GbttWeekDate", "Origin", "Destination", "TrainCount", "OnTimeArrivals")])
#> GbttWeekDate Origin Destination TrainCount OnTimeArrivals #> 2016-11-27 CRE BHI 2 0 #> 2016-12-04 CRE BHI 5 0 #> 2016-12-11 CRE BHI 4 0 #> 2016-12-18 CRE BHI 5 1 #> 2016-12-25 CRE BHI 4 0
qtbl(bhmsummary[1:5, c("GbttWeekDate", "Origin", "Destination", "TrainCount", "OnTimeArrivals")], columnNamesAsColumnHeaders=FALSE, explicitColumnHeaders=c("Week", "From", "To", "Trains", "On-Time"))
#> Week From To Trains On-Time #> 2016-11-27 CRE BHI 2 0 #> 2016-12-04 CRE BHI 5 0 #> 2016-12-11 CRE BHI 4 0 #> 2016-12-18 CRE BHI 5 1 #> 2016-12-25 CRE BHI 4 0