Learn R Programming

daff (version 1.1.1)

render_diff: Render a data_diff to html

Description

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.

Usage

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

Value

generated html

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

See Also

data_diff

Examples

Run this code
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)

Run the code above in your browser using DataLab