Hi,
Thanks for the reproduction information. Thanks to it I get the same behavior, using v1.5 compiled from source. While not having the same data as you of course, I could mock up something close. I do get a ParseException on the same line as you. The root cause is the call to the native R_tryEval that returns a code that an error occured, see below. Unfortunately without recompiling R with Visual C++ in debug mode, I have no further idea why tryEval fails on this. Compiling R with Visual C++ is a vexed issue, no way I can do that. Maybe with a decent visual environment for GDB, but we'd have to reproduce on Linux.
Anyway, it has to be something pretty low-level happening in dev.copy in a context that somehow differs between RGui and run from the CLR via R.NET.
Maybe the coordinator Kosei has an insight.
It would be nice to nail this one; even "just" figuring out a method to further diagnose these ParseException issues would be valuable learning.
Again, thank you for your interest.
Thanks for the reproduction information. Thanks to it I get the same behavior, using v1.5 compiled from source. While not having the same data as you of course, I could mock up something close. I do get a ParseException on the same line as you. The root cause is the call to the native R_tryEval that returns a code that an error occured, see below. Unfortunately without recompiling R with Visual C++ in debug mode, I have no further idea why tryEval fails on this. Compiling R with Visual C++ is a vexed issue, no way I can do that. Maybe with a decent visual environment for GDB, but we'd have to reproduce on Linux.
Anyway, it has to be something pretty low-level happening in dev.copy in a context that somehow differs between RGui and run from the CLR via R.NET.
Maybe the coordinator Kosei has an insight.
It would be nice to nail this one; even "just" figuring out a method to further diagnose these ParseException issues would be valuable learning.
Again, thank you for your interest.
IntPtr pointer = Engine.GetFunction<R_tryEval>("R_tryEval")(handle, environment.DangerousGetHandle(), out errorOccurred);
Dim envPath = Environment.GetEnvironmentVariable("PATH")
Dim rBinPath = "C:\Program Files\R\R-3.0.0\bin\x64"
Environment.SetEnvironmentVariable("PATH", envPath + Path.PathSeparator + rBinPath)
'REngine.SetDllDirectory("C:\Program Files\R\R-3.0.0\bin\x64")
REngine.CreateInstance("RDotNet")
Dim engine As REngine = REngine.GetInstanceFromID("RDotNet")
engine.Initialize()
With engine
'.Evaluate("source('f:/tmp/test.R')")
.Evaluate("library(ggplot2)")
.Evaluate("library(scales)")
.Evaluate("library(plyr)")
.Evaluate("d <- data.frame( x = rnorm(1000), y = rnorm(1000), z = rnorm(1000))")
.Evaluate("p <- ggplot(d, aes(x = x, y = y, color = z)) + geom_point(size=4.5, shape=19)")
.Evaluate("p ")
.Evaluate("dev.copy(png, 'F:/tmp/r.png')")
.Evaluate("dev.off()")
End With
library(ggplot2)
library(scales)
library(plyr)
d <- data.frame( x = rnorm(1000), y = rnorm(1000), z = rnorm(1000))
p <- ggplot(d, aes(x = x, y = y, color = z)) + geom_point(size=4.5, shape=19)
p
dev.copy(png, 'F:/tmp/r.png')
dev.off()