The export_png()
function in the R ggvis package requires us to have the program vg2png
installed, from the node.js module vega
.
(source: R Documentation )
I have node and npm installed on windows, and I ran npm install vega
.
This is the output that I got on running npm install vega
:
C:\Users\username>npm install -g trifacta/vega
\
> [email protected] install C:\Users\username\AppData\Roaming\npm\node_modules\vega\node_modules\canvas
> node-gyp rebuild
|
C:\Users\username\AppData\Roaming\npm\node_modules\vega\node_modules\canvas>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bi
n\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Node Commands
Syntax:
node {operator} [options] [arguments]
Parameters:
/? or /help - Display this help message.
list - List nodes or node history or the cluster
listcores - List cores on the cluster
view - View properties of a node
online - Set nodes or node to online state
offline - Set nodes or node to offline state
pause - Pause node [deprecated]
resume - Resume node [deprecated]
For more information about HPC command-line tools,
see http://go.microsoft.com/fwlink/?LinkId=120724.
C:\Users\username\AppData\Roaming\npm\vg2svg -> C:\Users\username\AppData\Roaming\npm\node_modules\vega\bin\vg2svg
C:\Users\username\AppData\Roaming\npm\vg2png -> C:\Users\username\AppData\Roaming\npm\node_modules\vega\bin\vg2png
[email protected] C:\Users\username\AppData\Roaming\npm\node_modules\vega
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], tunnel-agen
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
0.1, [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected])
I'm not sure if it has installed correctly. Now, when I run:
mtcars %>%
ggvis(x = ~wt) %>%
export_png()
I get the following error:
Writing to file plot.png
Error in vega_file(vis, file = file, type = "png") :
Conversion program vg2pngnot found.
Is there a specific way in which vega has to be installed on Windows, which would resolve this error?