[Rcpp-devel] Calling ggsave or pdf from RInside

Michael Morrison mwmorrison93 at gmail.com
Fri Apr 1 20:07:29 CEST 2016


Thanks again Dirk, is there a way that I can specify the root R directory?
I want to keep the working directory as is but when a library folder is
referenced as in the case with grDevices, i would like it to use
$(R_HOME)\library\grDevices\.... The root R folder isn't being picked up
correctly. I do have a $R_HOME  environment variable set up but it appears
not be used. Here's the script that i'm running via calls to the RInside
library, each call works until I get to ggsave(...) and at that point i get
the error message about not being able to find the file
'?,x`/library/grDevices/afm/Helvetica.afm'

require(graphics)
library("ggplot2")
nmmaps<-read.csv("C:/path/to/datafiles/data.csv",as.is=T)
nmmaps$date<-as.Date(nmmaps$date)
nmmaps<-nmmaps[nmmaps$date>as.Date("1996-12-31"),]
nmmaps$year<-substring(nmmaps$date,1,4)
head(nmmaps)
ggplot(nmmaps,aes(date,temp, color=factor(season)))+geom_point()

ggsave("C:/Path/to/file/myimage.pdf",
encoding="C:/R/R-3.2.4/library/grDevices/enc/WinAnsi")


Thank you,
Michael

On Fri, Apr 1, 2016 at 9:49 AM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 1 April 2016 at 09:29, Michael Morrison wrote:
> | Thanks for your reply, much appreciated. The call works just fine if I
> make it
> | from the R GUI or R studio. I tested out the calls there first before
> trying to
> | make the same calls from RInside. Do you know if there's a way that the
> base
> | directory can be set through some other call?
>
> In R:     setwd()
>
> In C++:   chdir()
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160401/7d8347a2/attachment.html>


More information about the Rcpp-devel mailing list