[Rcpp-devel] Calling ggsave or pdf from RInside

Dirk Eddelbuettel edd at debian.org
Fri Apr 1 15:09:14 CEST 2016

On 31 March 2016 at 21:13, Michael Morrison wrote:
| Hello, i'm new to RInside and Rcpp. I trying to run a small test to output a a
| pdf using a series of calls to the RInside library. Whenever I call ggsave (or
| pdf) via these calls i get the following error message:
| Error in pdf(file = "C:/path/to/file/file.pdf", height = 3.5,  :
|   failed to initialise default PDF font
| In addition: Warning messages:
| 1: In pdf(file = "C:/path/to/file/file.pdf", height = 3.5,  :
|   afm file '?,x`/library/grDevices/afm/Helvetica.afm' could not be opened
| 2: In pdf(file = "C:/path/to/file/file.pdf", height = 3.5,  :
|   cannot load afm file 'Helvetica.afm'
| terminate called after throwing an instance of 'std::runtime_error'
|   what():  Error evaluating: pdf(file="C:/path/to/file/file.pdf, height=3.5,
| width=5, encoding="C:/R/R-3.2.4/library/grDevices/enc/WinAnsi")
| I have R 3.2.4 installed on a Windows Server 2008 R2 box. as you can see the
| base directory used to search for the font isn't C:\R\R-3.2.4\.... as it should
| be but instead a strange base directory "?,x" is being used. Is there some way
| that I can set the base directory to the proper location. I apologize if I
| haven't provide enough information to help troubleshoot, if not just please let
| me know what I need to send and I will do so promptly.

Sounds like a Windows issue. In essence, RInside calls R just like you would
on the command-line (or through whatever GUI).  If R is lacking font
information when running by itself, it will also lack them in RInside.

The examples show plotting routines, including printing to bitmaps. That all
works just fine on normal systems with all the font information (ie my Linux
machines) and also on the Windows machines I tried.


http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org

More information about the Rcpp-devel mailing list