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: ‘lubridate’

The following objects are masked from ‘package:base’:

    date, intersect, setdiff, union

Loading required package: tidyr

Attaching package: ‘tidyr’

The following object is masked from ‘package:magrittr’:

    extract

Loading required package: dplyr

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union


Attaching package: ‘radiant.data’

The following objects are masked from ‘package:lubridate’:

    month, wday

The following object is masked from ‘package:ggplot2’:

    diamonds

The following object is masked from ‘package:magrittr’:

    set_attr

The following object is masked from ‘package:base’:

    date

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



Attaching package: ‘htmlwidgets’

The following object is masked from ‘package: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.