Quantcast
Channel: R.NET
Viewing all articles
Browse latest Browse all 1634

Edited Issue: Access Violation Exception when creating jpg/png files [23]

$
0
0
The call to the png function below results in an exception: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Any ideas?

Private Sub CallRDotNetButton_Click(sender As Object, e As System.EventArgs) Handles CallRDotNetButton.Click
If MyREngine Is Nothing Then
Dim dllDir As String = Server.MapPath("~/_R/Program/bin/i386")
Dim progDir As String = Server.MapPath("~/_R/Program")
RDotNet.REngine.SetDllDirectory(dllDir)
Dim rhome As String = System.Environment.GetEnvironmentVariable("R_HOME")
If (String.IsNullOrEmpty(rhome)) Then
rhome = progDir
System.Environment.SetEnvironmentVariable("R_HOME", rhome)
System.Environment.SetEnvironmentVariable("PATH", System.Environment.GetEnvironmentVariable("PATH") + ";" + dllDir)
End If

Dim args As String() = {"-q"}.ToArray
MyREngine = RDotNet.REngine.CreateInstance("RDotNet", args)
' MyREngine = RDotNet.REngine.CreateInstance("RDotNet")
End If

Dim group2 As RDotNet.SymbolicExpression = MyREngine.EagerEvaluate("group2 <- c(29.89, 29.93, 29.72, 29.98, 30.02, 29.98)")

Dim pngPath As String = Server.MapPath("~/_R/Data/testit.png")
MyREngine.EagerEvaluate("png('" & pngPath & "');") ' << FAILS
MyREngine.EagerEvaluate("plot(group2);")
MyREngine.EagerEvaluate("dev.off();")
End Sub



Viewing all articles
Browse latest Browse all 1634

Trending Articles