Unicode character file path in Rscript.exe

I am trying to save an SVG image to a file path containing Unicode characters. For example:

n = c(2, 3, 5) s = c("aa", "bb", "cc") b = c(TRUE, FALSE, TRUE) df = data.frame(n, s, b) svg("c:/ื ื•ืขื/plots.svg") plot(df) dev.off() 

Running this with Rscript.exe fails with the following error:

Error in plot.new (): Cairo error "Error writing to output stream"

How can I make this work?

+8
filesystems r unicode svg rscript
source share
2 answers

You can install the working directory into a directory with a name in Hebrew than save the SVG file. Please see the code below:

 n <- c(2, 3, 5) s <- c("aa", "bb", "cc") b <- c(TRUE, FALSE, TRUE) df <- data.frame(n, s, b) setwd("C:\\ื ื•ืขื\\") svg("plots.svg") plot(df) dev.off() 
0
source share

Late, but I think that porting the path to enc2native() it seems to me, usually solves encoding problems under Windows. In your case you should try

 svg(enc2native("c:/ื ื•ืขื/plots.svg")) 
0
source share

All Articles