Converts a diff_data object to HTML code, and opens the resulting HTML code in a browser window if view==TRUE and R is running interactively.

render_diff(
  diff,
  file = tempfile(fileext = ".html"),
  view = interactive(),
  fragment = FALSE,
  pretty = TRUE,
  title,
  summary = !fragment,
  use.DataTables = !fragment
)

Arguments

diff

diff_data object generated with diff_data

file

character target file (optional)

view

logical Open the generated HTML in a browser if R is being used interactively

fragment

logical If TRUE generate (just) an HTML table, otherwise generate a valid HTML document.

pretty

logical Use HTML arrow characters instead of '-->'.

title

character title text. Defaults to the quoted names of the data objects compared, separated by 'vs.'

summary

logical Should a summary of changes be shown above the HTML table?

use.DataTables

logical Include jQuery DataTables plugin and enable: - pagination (10,25,50,100,All) - searching - filtering - column visibility (individually enable/disable) - copy/csv/excel/pdf export buttons - column reorder (drag and drop) - row reorder (drag and drop) - row/multirow select

Value

generated html

See also

data_diff

Examples

y <- iris[1:3,]
x <- y

x <- head(x,2) # remove a row
x[1,1] <- 10 # change a value
x$hello <- "world"  # add a column
x$Species <- NULL # remove a column

patch <- diff_data(y, x)
render_diff(patch, title="compare x and y", pretty = TRUE)

#apply patch
y_patched <- patch_data(y, patch)