Skip to content

Commit

Permalink
Remove the check for Tcl/Tk
Browse files Browse the repository at this point in the history
we go for the safer option to use default CRAN mirror and disable chooseCRANmirror()
  • Loading branch information
Valentin Georgiev committed May 23, 2012
1 parent 03872e8 commit af88108
Showing 1 changed file with 6 additions and 15 deletions.
Expand Up @@ -418,34 +418,25 @@ public boolean accept(File dir, String name) {
status += NEWLINE + "Use load(\"file\") and save.image(\"file\") to manage your R sessions";
if (OS.startsWith("Mac")) { // the default plotting device on Mac(Quartz) is not working good with StatET
eval("options(device='x11')");
String tcltk = eval("loadNamespace(\"tcltk\")");
if (tcltk.contains("Warning message:")) {
tcltkStatus = false;
status += NEWLINE + NEWLINE + "WARNING!" + NEWLINE +
"Tcl/Tk for X11 was not found on your system." + NEWLINE +
"Install the latest version of the library from http://cran.freestatistics.org/bin/macosx/tools/";
}

}
}

public String eval(String command) {
logger.debug("R cmd: " + command);
String returnVal = "R console is inactivated: " + status;
if (working) {
if (command.contains("install.packages") && OS.startsWith("Mac") && !tcltkStatus) {
if (command.contains("install.packages") && OS.startsWith("Mac")) {
int i = command.lastIndexOf(")");
StringBuilder cmdTcltk = new StringBuilder(command.substring(0, i));
cmdTcltk.append(", repos=\"http://cran.us.r-project.org\")");
command = cmdTcltk.toString();
System.out.println(i);
StringBuilder cmdDefMirror = new StringBuilder(command.substring(0, i));
cmdDefMirror.append(", repos=\"http://cran.us.r-project.org\")");
command = cmdDefMirror.toString();
}
if (command.startsWith("?"))
returnVal = help(command.substring(1));
else if (command.contains("quartz"))
returnVal = "quartz() is currently disabled for stability reasons" + NEWLINE + "Please use X11 for plotting!";
else if (command.contains("chooseCRANmirror") && !tcltkStatus)
returnVal = "ChooseCRANmirror is not available without Tcl/Tk for X11.";
else if (command.contains("chooseCRANmirror") && OS.startsWith("Mac"))
returnVal = "ChooseCRANmirror is not available on Mac OS X.";
else try {
RObject data = rservi.evalData("capture.output("+command+")", null); // capture.output(print( )) gives a string output from R, otherwise R objects. The extra pair of () is needed for the R function print to work properly.
RStore rData = data.getData();
Expand Down

0 comments on commit af88108

Please sign in to comment.