htmlwidgets

0th

Percentile

HTML Widgets for graphical comparison

These widgets can be used at the console and embedded in a R Markdown document or Shiny application.

Usage
widget_toggle_(before, after, ..., width = NULL, height = NULL)

widget_slide_(before, after, ..., width = NULL, height = NULL)

widget_diff_(before, after, ..., width = NULL, height = NULL)

widget_toggle(before, after, ..., width = NULL, height = NULL)

widget_slide(before, after, ..., width = NULL, height = NULL)

widget_diff(before, after, ..., width = NULL, height = NULL)

Arguments
before

The picture that is taken as reference.

after

The picture against which the reference is compared.

...

Unused. Meant for collecting unknown arguments and allow widget extensions.

width

Fixed width for widget (in css units). The default is NULL, which results in intelligent automatic sizing based on the widget's container.

height

Fixed height for widget (in css units). The default is NULL, which results in intelligent automatic sizing based on the widget's container.

Details

The regular versions take plots or functions as before and after arguments (see expect_doppelganger() for details). The versions suffixed with underscores take HTML image sources. These can be paths to SVG files or inlined SVG images. Currently, widget_diff_() is compatible only with inlined images.

Aliases
  • htmlwidgets
  • widget_toggle_
  • widget_slide_
  • widget_diff_
  • widget_toggle
  • widget_slide
  • widget_diff
Examples
# NOT RUN {
p1 <- function() hist(mtcars$disp)
p2 <- function() hist(mtcars$drat)

# You can also call these functions in a R Markdown document or
# in a Shiny application:
widget_toggle(p1, p2)
widget_slide(p1, p2)
widget_diff(p1, p2)
# }
Documentation reproduced from package vdiffr, version 0.3.0, License: GPL-3 | file LICENSE

Community examples

Looks like there are no examples yet.