Open Wario84 opened 8 years ago
This is a bit of a work around, and hopefully you'll get help from someone who actually knows what they're talking about, but check out ggvis:::vega_file
:
> ggvis:::vega_file
function (vis, file = NULL, type = "png")
{
if (!(type %in% c("png", "svg")))
stop("type must be 'png' or 'svg'")
if (is.null(file)) {
file <- paste0("plot.", type)
message("Writing to file ", file)
}
temp_dir <- tempfile(pattern = "ggvis")
dir.create(temp_dir)
cmd <- paste0("vg2", type)
cmdsearch <- Sys.which(paste0(c("", "./bin/", "./node_modules/.bin/"),
cmd))
found_idx <- which(nzchar(cmdsearch))
if (length(found_idx) == 0)
stop("Conversion program ", cmd, "not found.")
cmd <- cmdsearch[min(found_idx)]
json_file <- file.path(temp_dir, "plot.json")
vega_json <- save_spec(vis, json_file)
on.exit(unlink(json_file))
system2(cmd, args = c(json_file, file))
}
<environment: namespace:ggvis>
It's looking for vg2png
in either the current directory or in ./nodemodules/bin
.
As a work around, try to find the vg2png
file on your computer (I installed vega
from github so I just set the working directory to the base repo for vega
) and set your working directory there.
Hi guys,
Hope that you can help me out. I have invested quite some time tryinng to set up the export function, both Linux and Windows, without success. I will post the procedure that I followed.
Installation of node.js + vega
To instaI node.js in Linux, I followed the procedure suggested
sudo apt-get install curl
npm config set prefix '~/npm'
export PATH="$HOME/npm/bin:$PATH"
. ~/.bashrc
echo $PATH
My R code
Any ideas how to solve this?