# Plot a DTU table to HTML and image

Source: `R/visualization.R`
`plot_dtu_table.Rd`

Creates a enhanced HTML representation of a DTU table. The table can be (color) formatted individually by providing `column_formatters`. Also automatically links columns of plot names, to be viewable in the table. Currently you are not allowed to provide a column formatter for plot columns.

    plot_dtu_table(
      dturtle,
      columns = NULL,
      column_formatters = list(),
      order_by = NULL,
      num_digits = NULL,
      num_digits_format = NULL,
      min_page_length = 25,
      savepath = NULL,
      create_table_image = FALSE,
      ...
    )

## Arguments

dturtle | `dturtle` result object of `create_dtu_table()`.
columns | Optionally subset the existing `dtu_table` of the `dturtle` object to the columns specified here.
column_formatters | Named list of column_formatters, specifying a formatter function for every column that shall be formatted. The formatter functions are either from this package like `table_percentage_bar()`, `table_pval_tile()` or from `formattable`.
order_by | One or multiple columns to order the table by. Must be a vector of column names, descending order can be achieved by prepending a '-' (e.g. `c("-my_col_name")`).
num_digits | Number of digits, numerical columns shall be formatted to. Can be a single number to apply to all numerical columns, or a number for each numerical column (in their order).
num_digits_format | Digit format string, as in `formatC`. These format string are used in numerical columns formatting if `num_digits` is provided. Can be a single format string to apply same format to all numerical columns, or a format string for each numerical column (in their order).
min_page_length | Specify the minimal number of items, available to display in the table. Will be used as default number of items.
savepath | Specify save path, if the HTML table shall be saved to disk. The same path is used to create a table image, if `create_table_image` is not `FALSE`. The directories will be created if necessary.
create_table_image | Set number of table rows for optionally saving a image representation of the subsetted HTML table. Utilizes the package `webshot` or `webshot2`.

...

Arguments passed on to `formattable::format_table`

`x`

  a `data.frame`.

`formatters`

  a list of formatter functions or formulas. The existing columns of `x` will be applied the formatter function in `formatters` if it exists.If a formatter is specified by formula, then the formula will be interpreted as a lambda expression with its left-hand side being a symbol and right-hand side being the expression using the symbol to represent the column values. The formula expression will be evaluated in the environment of the formula.If a formatter is `FALSE`, then the corresponding column will be hidden.Area formatter is specified in the form of `area(row, col) ~ formatter` without specifying the column name.

`format`

  The output format: html, markdown or pandoc?

`align`

  The alignment of columns: a character vector consisting of `'l'` (left), `'c'` (center), and/or `'r'` (right). By default, all columns are right-aligned.

`digits`

  The number of significant digits to be used for numeric and complex values.

`table.attr`

  The HTML class of `<table>` created when `format = "html"`

## Value

A datatables object, if no savepath is provided.

## Details

The table can optionally also be saved as an image ('.png'), by specifying the wanted number of rows to create_table_image.