Last active
August 29, 2015 14:16
-
-
Save felixlindemann/ea04e8e6595dfb8be582 to your computer and use it in GitHub Desktop.
Dispose of R.Net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void Dispose() | |
{ | |
if (this.rEngine != null) | |
{ | |
try | |
{ | |
// if any plots are open, they have to be closed | |
// before shooting down R | |
int I = this.getInt("length(dev.list())"); | |
for (int i = 0; i < I; i++) | |
{ | |
this.EvaluateLine("dev.off()"); | |
} | |
// Shoot down | |
this.rEngine.Dispose(); | |
this.rEngine = null; | |
} | |
catch (Exception ex) | |
{ | |
MessageBox.Show(ex.ToString(), "Error while shooting down R"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment