widgetThumbnail: Capture html output widget as .png in R

Description Usage Arguments Value Examples

View source: R/phantomJS.R

Description

Capture html output widget as .png in R

Usage

1
widgetThumbnail(p, thumbName, width = 1024, height = 1024)

Arguments

p

is the html widget

thumbName

is the name of the new png file

width

1024

height

1024

Value

3 files .html, .js and .png

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
How <- "runManually"
## Not run: 
# Load package
library(networkD3)
library(htmlwidgets)
# Create fake data
src <- c("A", "A", "A", "A", "B", "B", "C", "C", "D")
target <- c("B", "C", "D", "J", "E", "F", "G", "H", "I")
networkData <- data.frame(src, target)
# Plot
plot = simpleNetwork(networkData)
# Save html as png
widgetThumbnail(p = plot, thumbName = "plot", width = 1024, height = 1024)

## End(Not run)

Example output

Loading required package: radiant.data
Loading required package: magrittr
Loading required package: ggplot2
Loading required package: lubridate

Attaching package:lubridateThe following objects are masked frompackage:base:

    date, intersect, setdiff, union

Loading required package: tidyr

Attaching package:tidyrThe following object is masked frompackage:magrittr:

    extract

Loading required package: dplyr

Attaching package:dplyrThe following objects are masked frompackage:stats:

    filter, lag

The following objects are masked frompackage:base:

    intersect, setdiff, setequal, union


Attaching package:radiant.dataThe following objects are masked frompackage:lubridate:

    month, wday

The following object is masked frompackage:ggplot2:

    diamonds

The following object is masked frompackage:magrittr:

    set_attr

The following object is masked frompackage:base:

    date

Loading required package: cgdsr
Please send questions to cbioportal@googlegroups.com
Loading required package: XML



Attaching package:htmlwidgetsThe following object is masked frompackage:networkD3:

    JS

** phantomjs dependency could not be found - thumbnail cannot be generated.
            Please visit this page to install phantomjs on your system: http://phantomjs.org/download.html)
** could not create htmlwidget thumbnail... creating an empty thumbnail...

bioCancer documentation built on Nov. 8, 2020, 6:26 p.m.