#Install file for GCDkit 3.00 patch no 130605 #The patch may be installed by: # * copying the install file into directory GCDkit/Patch # * drag & drop of this install file into the R Console # * manual pasting of the install file content into the R Console (ctrl-C, ctrl-V) patchID<-"130605" if (file.access(paste(gcdx.dir,"/Patch/patch",patchID,".r",sep=""), mode = 4)==-1){ cat ("Installing the file patch",patchID,".r\n",sep="") patch<-c( "#GCDkit 3.00 patch no 130605 ", "", "#updated function plateCexLab()", "plateCexLab<-","function (n = NULL) " , "{" , " on.exit(options(show.error.messages = TRUE))" , " if (length(plate.data) == 1) {" , " winDialog(type = \"ok\", \"No plate defined yet!\")" , " return(invisible())" , " }" , " if (is.null(n)) {" , " n <- winDialogString(\"Scaling for labels\", \"1\")" , " if (is.null(n)) {" , " cat(\"Cancelled.\\n\")" , " options(show.error.messages = FALSE)" , " stop()" , " }" , " }" , " if (is.na(as.numeric(n))) {" , " winDialog(type = \"ok\", \"Invalid size specification!\")" , " options(show.error.messages = FALSE)" , " stop(\"\", call. = FALSE)" , " }" , " n <- as.numeric(n)" , " options(show.error.messages = FALSE)" , " try(.plateFig(paste(\"figCexLab(\", n, \")\", sep = \"\")))" , " options(show.error.messages = TRUE)" , " plateRedraw()" , " invisible()" , "}" , "", "#updated function Verma()", "Verma<-","function (FeMiddlemost = NULL) " , "{" , " on.exit(options(show.error.messages = TRUE))" , " if (!any(colnames(WR) == \"SiO2\")) {" , " winDialog(type = \"ok\", \"No SiO2 data found!\")" , " options(show.error.messages = FALSE)" , " stop(call. = FALSE)" , " }" , " i <- WR[, \"SiO2\"] < 52" , " if (all(!i)) {" , " winDialog(type = \"ok\", \"No data found with SiO2<52 wt.%!\")" , " options(show.error.messages = FALSE)" , " stop(call. = FALSE)" , " }" , " ee <- filterOut(WR[i, ], c(\"SiO2\", \"Al2O3\", \"FeOt\", \"MnO\", " , " \"MgO\", \"CaO\", \"Na2O\", \"K2O\", \"P2O5\"), 1)" , " if (nrow(ee) == 0) {" , " winDialog(type = \"ok\", \"No data found with all majors and SiO2<52 wt.%!\")" , " options(show.error.messages = FALSE)" , " stop(call. = FALSE)" , " }" , " if (is.null(FeMiddlemost)) {" , " adjustFe <- (winDialog(type = \"yesno\", \"Adjust Fe2O3/FeO ratio according to Middlemost (1989)?\"))" , " adjustFe <- adjustFe == \"YES\"" , " }" , " else {" , " adjustFe <- FeMiddlemost" , " }" , " if (adjustFe) {" , " WRanh <- FeMiddlemost()" , " }" , " else {" , " ee1 <- filterOut(WR[i, ], c(\"Fe2O3\", \"FeO\"), 1)" , " if (nrow(ee1) == 0) {" , " winDialog(type = \"ok\", \"No FeO and Fe2O3 data found and no FeOt recalculation option chosen!\")" , " options(show.error.messages = FALSE)" , " stop(call. = FALSE)" , " }" , " ee <- c(ee, ee1)" , " }" , " plate <- as.list(1:5)" , " plate.data <- as.list(1:5)" , " plate$nrow <- 2" , " plate$ncol <- 3" , " plate$title <- \"Geotectonic diagrams for (ultra-)basic rocks of Verma et al. (2006)\"" , " plate$plot.position <- 21" , " plate$plot.name <- \"major elements (Verma et al. 2006)\"" , " cex.axis <- 1.2" , " cex.lab <- 1.35" , " plate.data[[1]]$x <- -4.6761 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) + 2.533 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) - " , " 0.3884 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) + 3.9688 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) + 0.898 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) - 0.5832 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 0.2896 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) - " , " 0.2704 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) + 1.081 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) + 0.1845 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 1.5445" , " plate.data[[1]]$y <- 0.6751 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) + 4.5895 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 2.0897 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) + 0.8514 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) - 0.4334 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 1.4832 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 2.3627 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) - " , " 1.6558 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) + 0.6757 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) + 0.413 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 13.1639" , " temp1 <- list(axis1 = list(\"axis\", side = 1, at = c(-8, -4, " , " 0, 4, 8), labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, lty = \"solid\"), " , " axis2 = list(\"axis\", side = 2, at = c(-8, -4, 0, 4, 8), " , " labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, " , " lty = \"solid\"), box = list(\"box\", which = \"plot\", " , " col = \"black\", lwd = 1), lines1 = list(\"lines\", x = c(1.16, " , " 5.912), y = c(-0.333, 8), col = plt.col[2], lty = \"dashed\"), " , " lines2 = list(\"lines\", x = c(-0.266, -4.19), y = c(0.02, " , " 8), col = plt.col[2], lty = \"dashed\"), lines3 = list(\"lines\", " , " x = c(-8, -0.266), y = c(-2.49, 0.02), col = plt.col[2], " , " lty = \"dashed\"), lines4 = list(\"lines\", x = c(1.16, " , " 3.431), y = c(-0.333, -8), col = plt.col[2], lty = \"dashed\"), " , " lines5 = list(\"lines\", x = c(1.16, -0.266), y = c(-0.333, " , " 0.02), col = plt.col[2], lty = \"dashed\"))" , " temp2 <- list(text1 = list(\"text\", x = -6, y = 4, text = \"OIB\", " , " cex = 1, col = plt.col[2]), text2 = list(\"text\", x = -6, " , " y = -4, text = \"MORB\", cex = 1, col = plt.col[2]), text3 = list(\"text\", " , " x = 0, y = 7, text = \"CRB\", cex = 1, col = plt.col[2]), " , " text4 = list(\"text\", x = 6, y = 4, text = \"IAB\", cex = 1, " , " col = plt.col[2]))" , " if (getOption(\"gcd.plot.text\")) " , " temp <- c(temp1, temp2)" , " else temp <- temp1" , " plate[[1]] <- list(demo = list(fun = \"plot\", call = list(xlim = c(-8, " , " 8), ylim = c(-8, 8), main = \"\", bg = \"white\", fg = \"black\", " , " axes = FALSE, xlab = \"DF1\", ylab = \"DF2\", cex.lab = cex.lab, " , " new = FALSE), template = temp))" , " plate.data[[2]]$x <- 3.9998 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) - 2.2385 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 0.811 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) - 2.5865 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) - 1.2433 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 0.4872 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 0.3153 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) + " , " 0.4325 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) - 1.0262 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) + 0.0514 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) - 0.5718" , " plate.data[[2]]$y <- -1.3705 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) + 3.0104 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 0.3239 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) + 1.8998 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) - 1.9746 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 1.4411 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 2.2656 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) + " , " 1.8665 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) + 0.2872 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) + 0.8138 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 1.8202" , " temp1 <- list(axis1 = list(\"axis\", side = 1, at = c(-8, -4, " , " 0, 4, 8), labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, lty = \"solid\"), " , " axis2 = list(\"axis\", side = 2, at = c(-8, -4, 0, 4, 8), " , " labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, " , " lty = \"solid\"), box = list(\"box\", which = \"plot\", " , " col = \"black\", lwd = 1), lines1 = list(\"lines\", x = c(-0.733, " , " -3.788), y = c(-1.405, 8), col = plt.col[2], lty = \"dashed\"), " , " lines2 = list(\"lines\", x = c(-0.733, 8), y = c(-1.405, " , " 5.428), col = plt.col[2], lty = \"dashed\"), lines3 = list(\"lines\", " , " x = c(-1.343, -0.733), y = c(-8, -1.405), col = plt.col[2], " , " lty = \"dashed\"))" , " temp2 <- list(text1 = list(\"text\", x = 6, y = -3, text = \"OIB\", " , " cex = 1, col = plt.col[2]), text3 = list(\"text\", x = -1, " , " y = 6, text = \"CRB\", cex = 1, col = plt.col[2]), text4 = list(\"text\", " , " x = -6, y = 6, text = \"IAB\", cex = 1, col = plt.col[2]))" , " if (getOption(\"gcd.plot.text\")) " , " temp <- c(temp1, temp2)" , " else temp <- temp1" , " plate[[2]] <- list(demo = list(fun = \"plot\", call = list(xlim = c(-8, " , " 8), ylim = c(-8, 8), main = \"\", bg = \"white\", fg = \"black\", " , " axes = FALSE, xlab = \"DF1\", ylab = \"DF2\", cex.lab = cex.lab, " , " new = FALSE), template = temp))" , " plate.data[[3]]$x <- -1.5736 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) + 6.1498 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 1.5544 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) + 3.4134 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) - 0.0087 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 1.248 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 2.1103 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) - " , " 0.7576 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) + 1.1431 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) + 0.3524 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 16.8712" , " plate.data[[3]]$y <- 3.9844 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) + 0.22 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 1.1516 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) - 2.2036 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) - 1.6228 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 1.4291 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 1.2524 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) + " , " 0.3581 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) - 0.6414 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) + 0.2646 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 5.0506" , " temp1 <- list(axis1 = list(\"axis\", side = 1, at = c(-8, -4, " , " 0, 4, 8), labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, lty = \"solid\"), " , " axis2 = list(\"axis\", side = 2, at = c(-8, -4, 0, 4, 8), " , " labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, " , " lty = \"solid\"), box = list(\"box\", which = \"plot\", " , " col = \"black\", lwd = 1), lines1 = list(\"lines\", x = c(8, " , " 0.361), y = c(-1.332, -0.619), col = plt.col[2], " , " lty = \"dashed\"), lines2 = list(\"lines\", x = c(-2.673, " , " 0.361), y = c(8, -0.619), col = plt.col[2], lty = \"dashed\"), " , " lines3 = list(\"lines\", x = c(-6.779, 0.361), y = c(-8, " , " -0.619), col = plt.col[2], lty = \"dashed\"))" , " temp2 <- list(text1 = list(\"text\", x = 6, y = -5, text = \"IAB\", " , " cex = 1, col = plt.col[2]), text3 = list(\"text\", x = 1, " , " y = 6, text = \"CRB\", cex = 1, col = plt.col[2]), text4 = list(\"text\", " , " x = -5, y = 6, text = \"MORB\", cex = 1, col = plt.col[2]))" , " if (getOption(\"gcd.plot.text\")) " , " temp <- c(temp1, temp2)" , " else temp <- temp1" , " plate[[3]] <- list(demo = list(fun = \"plot\", call = list(xlim = c(-8, " , " 8), ylim = c(-8, 8), main = \"\", bg = \"white\", fg = \"black\", " , " axes = FALSE, xlab = \"DF1\", ylab = \"DF2\", cex.lab = cex.lab, " , " new = FALSE), template = temp))" , " plate.data[[4]]$x <- 5.3396 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) - 1.6279 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 0.8338 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) - 4.7362 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) - 0.1254 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 0.6452 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) + 1.5153 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) - " , " 0.8154 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) - 0.8888 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) - 0.2255 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 5.7755" , " plate.data[[4]]$y <- 1.1799 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) + 5.5114 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 2.7737 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) - 0.1341 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) + 0.6672 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 1.1045 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 1.7231 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) - " , " 3.8948 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) + 0.9471 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) - 0.1082 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 15.4984" , " temp1 <- list(axis1 = list(\"axis\", side = 1, at = c(-8, -4, " , " 0, 4, 8), labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, lty = \"solid\"), " , " axis2 = list(\"axis\", side = 2, at = c(-8, -4, 0, 4, 8), " , " labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, " , " lty = \"solid\"), box = list(\"box\", which = \"plot\", " , " col = \"black\", lwd = 1), lines1 = list(\"lines\", x = c(-0.83, " , " -1.824), y = c(1.224, 8), col = plt.col[2], lty = \"dashed\"), " , " lines2 = list(\"lines\", x = c(-0.83, 8), y = c(1.224, " , " -3.583), col = plt.col[2], lty = \"dashed\"), lines3 = list(\"lines\", " , " x = c(-4.865, -0.83), y = c(-8, 1.224), col = plt.col[2], " , " lty = \"dashed\"))" , " temp2 <- list(text1 = list(\"text\", x = -4, y = 6, text = \"IAB\", " , " cex = 1, col = plt.col[2]), text3 = list(\"text\", x = -1, " , " y = -6, text = \"MORB\", cex = 1, col = plt.col[2]), text4 = list(\"text\", " , " x = 1, y = 6, text = \"OIB\", cex = 1, col = plt.col[2]))" , " if (getOption(\"gcd.plot.text\")) " , " temp <- c(temp1, temp2)" , " else temp <- temp1" , " plate[[4]] <- list(demo = list(fun = \"plot\", call = list(xlim = c(-8, " , " 8), ylim = c(-8, 8), main = \"\", bg = \"white\", fg = \"black\", " , " axes = FALSE, xlab = \"DF1\", ylab = \"DF2\", cex.lab = cex.lab, " , " new = FALSE), template = temp))" , " plate.data[[5]]$x <- -0.5183 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) + 4.9886 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 2.2204 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) + 1.1801 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) - 0.3008 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 1.3297 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) - 2.1834 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) - " , " 1.9319 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) + 0.6976 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) + 0.8998 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 13.2625" , " plate.data[[5]]$y <- 5.0509 * log(WRanh[i, \"TiO2\"]/WRanh[i, " , " \"SiO2\"]) - 0.4972 * log(WRanh[i, \"Al2O3\"]/WRanh[i, \"SiO2\"]) + " , " 1.0046 * log(WRanh[i, \"Fe2O3\"]/WRanh[i, \"SiO2\"]) - 3.3848 * " , " log(WRanh[i, \"FeO\"]/WRanh[i, \"SiO2\"]) + 0.5528 * log(WRanh[i, " , " \"MnO\"]/WRanh[i, \"SiO2\"]) + 0.2925 * log(WRanh[i, \"MgO\"]/WRanh[i, " , " \"SiO2\"]) + 0.4007 * log(WRanh[i, \"CaO\"]/WRanh[i, \"SiO2\"]) - " , " 2.8637 * log(WRanh[i, \"Na2O\"]/WRanh[i, \"SiO2\"]) - 0.2189 * " , " log(WRanh[i, \"K2O\"]/WRanh[i, \"SiO2\"]) - 1.0558 * log(WRanh[i, " , " \"P2O5\"]/WRanh[i, \"SiO2\"]) + 2.8877" , " temp1 <- list(axis1 = list(\"axis\", side = 1, at = c(-8, -4, " , " 0, 4, 8), labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, lty = \"solid\"), " , " axis2 = list(\"axis\", side = 2, at = c(-8, -4, 0, 4, 8), " , " labels = c(\"-8\", \"-4\", \"0\", \"4\", \"8\"), cex.axis = cex.axis, " , " cex.lab = cex.lab, las = 0, hadj = NA, padj = NA, " , " lty = \"solid\"), box = list(\"box\", which = \"plot\", " , " col = \"black\", lwd = 1), lines1 = list(\"lines\", x = c(0.029, " , " 8), y = c(-0.222, 4.322), col = plt.col[2], lty = \"dashed\"), " , " lines2 = list(\"lines\", x = c(0.029, -6.177), y = c(-0.222, " , " 8), col = plt.col[2], lty = \"dashed\"), lines3 = list(\"lines\", " , " x = c(-0.819, 0.029), y = c(-8, -0.222), col = plt.col[2], " , " lty = \"dashed\"))" , " temp2 <- list(text1 = list(\"text\", x = -6, y = 2, text = \"MORB\", " , " cex = 1, col = plt.col[2]), text3 = list(\"text\", x = 5, " , " y = -2, text = \"CRB\", cex = 1, col = plt.col[2]), text4 = list(\"text\", " , " x = -1, y = 6, text = \"OIB\", cex = 1, col = plt.col[2]))" , " if (getOption(\"gcd.plot.text\")) " , " temp <- c(temp1, temp2)" , " else temp <- temp1" , " plate[[5]] <- list(demo = list(fun = \"plot\", call = list(xlim = c(-8, " , " 8), ylim = c(-8, 8), main = \"\", bg = \"white\", fg = \"black\", " , " axes = FALSE, xlab = \"DF1\", ylab = \"DF2\", cex.lab = cex.lab, " , " new = FALSE), template = temp))" , " assign(\"plate\", plate, .GlobalEnv)" , " assign(\"plate.data\", plate.data, .GlobalEnv)" , "}" , "", "#updated function .tkDirectory()", ".tkDirectory<-","function (top.frame = NULL, pack = FALSE, width = 60, background = \"gray95\", " , " on.leave = function() {" , " }, on.select = function() {" , " }) " , "{" , " textDir <- tclVar(data.dir)" , " frame <- tkframe(top.frame, borderwidth = 0, relief = \"groove\")" , " tkconfigure(frame, padx = 0, pady = 5)" , " abbrev <- function(width, what) {" , " x <- nchar(what)" , " if (x > width) " , " txt <- paste(\"...\", substring(what, x - width + 5, " , " x))" , " else txt <- substring(paste(what, \" \"), " , " 1, width)" , " return(txt)" , " }" , " OnFilenameBrowse <- function(dir) {" , " if (dir == \"\") " , " return()" , " assign(\"data.dir\", dir, env = .GlobalEnv)" , " textFilename <- tclVar(dir)" , " tkgrid(tklabel(frame, text = abbrev(width, dir), font = fontFileName), " , " sticky = \"w\", row = 0, column = 2)" , " }" , " OnSelectDir <- function() {" , " OnFilenameBrowse(tclvalue(tkchooseDirectory(initialdir = data.dir, " , " title = \"Select the GCDkit data directory\")))" , " }" , " fontFileName <- tkfont.create(family = \"courier\", size = 9)" , " SelectDir.but <- tkbutton(frame, text = \" ... \", command = OnSelectDir)" , " tkgrid(tklabel(frame, text = \"Working directory \", font = fontHeading, " , " background = background), SelectDir.but, sticky = \"w\")" , " text <- tclvalue(textDir)" , " tkgrid(tklabel(frame, text = abbrev(width, text), font = fontFileName), " , " sticky = \"w\", row = 0, column = 2)" , " tkbind(frame, \"\", on.leave)" , " tkgrid(frame)" , "}" , "", "#updated function tkSelectVariable()", "tkSelectVariable<-","function (top.frame = NULL, where = colnames(WR), preselect = 2, " , " pack = FALSE, message = \"Select a variable\", background = \"wheat\", " , " variable = \"x\", on.leave = function() {" , " }, row = 0, column = 0, height = 15, width = 50, buttons = FALSE, " , " state = \"normal\") " , "{" , " if (is.null(top.frame)) {" , " pack <- TRUE" , " }" , " ee <- selectSingle.tk(top.frame, where, preselect = preselect, " , " message = message, print = FALSE, empty.ok = FALSE, pack = pack, " , " variable = variable, background = background, on.leave = on.leave, " , " row = row, column = column, height = height, width = width, " , " buttons = buttons, state = state)" , "}" , "", "#updated function tkSelectVariables()", "tkSelectVariables<-","function (top.frame = NULL, pack = FALSE, where = colnames(WR), " , " preselect = 0:(length(where) - 1), background = \"wheat\", " , " message = \"Select variables\", variable = \"y\", on.leave = function() {" , " }, row = 0, column = 0, height = 15, width = 50, buttons = FALSE) " , "{" , " if (is.null(top.frame)) {" , " pack <- TRUE" , " }" , " ee <- selectSingle.tk(top.frame, where, message = message, " , " print = FALSE, preselect = preselect, empty.ok = FALSE, " , " pack = pack, variable = variable, background = background, " , " on.leave = on.leave, row = row, column = column, height = height, " , " width = width, selectmode = \"multiple\", buttons = buttons)" , "}" , "", "#updated function selectSingle.tk()", "selectSingle.tk<-","function (top.frame = tt, where = rownames(WR), message = \"Select sample\", " , " preselect = 2, default = \"\", silent = FALSE, print = TRUE, " , " empty.ok = TRUE, pack = TRUE, row = 0, column = 0, variable = \"xx\", " , " selectmode = \"single\", background = \"wheat\", on.leave = NULL, " , " show = NULL, height = 15, width = 30, buttons = TRUE, state = \"normal\") " , "{" , " names(where) <- 1:length(where)" , " assign(variable, where[preselect], env = .GlobalEnv)" , " if (print & !getOption(\"gcd.shut.up\")) {" , " cat(\"\\n\")" , " print(where)" , " cat(\"\\n\")" , " }" , " .tkSelectColumnMain <- function(where, where.bak, preselect = 0, " , " top.frame, background = \"wheat\") {" , " on.exit(options(show.error.messages = TRUE))" , " textEntry <- tclVar(selected)" , " listBoxEntry <- tclVar(\"\")" , " lim1 <- tclVar(\"\")" , " lim2 <- tclVar(\"\")" , " tkfocus(top.frame)" , " main.frame <- tkframe(top.frame, borderwidth = 0, relief = \"groove\")" , " tkconfigure(main.frame, padx = 5, pady = 5)" , " fontBody <- tkfont.create(family = \"times\", size = 9, " , " weight = \"bold\")" , " frame.textbox <- tkframe(main.frame, borderwidth = 1, " , " relief = \"groove\")" , " tkconfigure(frame.textbox, padx = 5, pady = 5)" , " OnReturn <- function() {" , " selected <- tclvalue(textEntry)" , " assign(\"selected\", selected, env = .GlobalEnv)" , " if (selected == \"\" & length(where) > 1) {" , " ee <- 1:length(where.bak)" , " }" , " else {" , " ee <- .selectColumnLabel.core(selected, where.bak, " , " empty.ok)" , " }" , " .tkSelectColumnMain(where.bak[ee], where.bak, preselect = 0, " , " top.frame = top.frame, background = background)" , " }" , " .tkEntryTexttMy(frame.textbox, textEntry, width = width - " , " nchar(message) + 8, text = message, on.return = OnReturn, " , " background = background)" , " tkgrid(frame.textbox, row = row, sticky = \"ew\")" , " frame.listbox <- tkframe(main.frame, borderwidth = 0, " , " relief = \"groove\")" , " tkfocus(frame.listbox)" , " listbox <- .tkListBoxMy(frame.listbox, where, listBoxEntry, " , " \"\", selectmode = selectmode, height = height, width = width, " , " preselect = preselect, show = show)" , " tkconfigure(listbox, state = state)" , " tkfocus(frame.listbox)" , " OnLeave2 <- function() {" , " selected <<- \"\"" , " xx <- where[as.numeric(tkcurselection(listbox)) + " , " 1]" , " names(xx) <- NULL" , " assign(variable, xx, env = .GlobalEnv)" , " on.leave()" , " }" , " tkbind(frame.listbox, \"\", OnLeave2)" , " tkgrid(frame.listbox, sticky = \"we\")" , " OnReset <- function() {" , " .tkSelectColumnMain(where.bak, where.bak, preselect = 0, " , " top.frame = top.frame)" , " }" , " OnOK <- function() {" , " xx <- where[as.numeric(tkcurselection(listbox)) + " , " 1]" , " names(xx) <- NULL" , " assign(variable, xx, env = .GlobalEnv)" , " if (pack) " , " tkdestroy(top.frame)" , " }" , " OnCancel <- function() {" , " cat(\"Cancelled....\\n\")" , " flush.console()" , " xx <<- \"\"" , " selected <<- \"\"" , " if (pack) " , " tkdestroy(top.frame)" , " }" , " OnSortUp <- function() {" , " where2 <- names(sort(WR[where, show], na.last = TRUE))" , " .tkSelectColumnMain(where2, where.bak, preselect = 0, " , " top.frame = top.frame)" , " }" , " OnSortDown <- function() {" , " where2 <- names(rev(sort(WR[where, show], na.last = TRUE)))" , " .tkSelectColumnMain(where2, where.bak, preselect = 0, " , " top.frame = top.frame)" , " }" , " if (buttons) {" , " frame.butt <- tkframe(main.frame, borderwidth = 1, " , " relief = \"groove\")" , " Plot.but <- tkbutton(frame.butt, text = \" ... \", " , " command = function() {" , " SelectFromPlot(\"MgO\")" , " textEntry <- tclVar(selected)" , " ee <- .selectColumnLabel.core(selected, where.bak, " , " empty.ok)" , " OnOK()" , " .tkSelectColumnMain(where.bak[ee], where.bak, " , " preselect = 0, top.frame = top.frame, background = background)" , " }, fg = \"red\")" , " Reset.but <- tkbutton(frame.butt, text = \" Reset \", " , " command = OnReset)" , " SortUp.but <- tkbutton(frame.butt, text = \" Sort Up\", " , " command = OnSortUp)" , " SortDown.but <- tkbutton(frame.butt, text = \" Sort Dn \", " , " command = OnSortDown)" , " Select.but <- tkbutton(frame.butt, text = \" OK \", " , " command = OnOK, fg = \"darkgreen\")" , " Cancel.but <- tkbutton(frame.butt, text = \" Cancel \", " , " command = OnCancel, fg = \"darkred\")" , " if (is.null(show)) {" , " tkgrid(Plot.but, Reset.but, Select.but, sticky = \"w\")" , " }" , " else {" , " tkgrid(Plot.but, Reset.but, SortUp.but, SortDown.but, " , " Select.but, sticky = \"w\")" , " }" , " tkgrid(frame.butt)" , " }" , " else {" , " tkbind(main.frame, \"\", OnOK)" , " }" , " tkgrid(main.frame, row = row, column = column, sticky = \"ns\")" , " if (pack & length(where) == 1) " , " return()" , " tkfocus(top.frame)" , " if (pack) " , " tkwait.window(top.frame)" , " return()" , " }" , " if (pack) {" , " require(tcltk) || stop(\"tcltk support is absent\")" , " top.frame <<- tktoplevel()" , " tkwm.title(top.frame, \"Select a variable\")" , " }" , " xx <<- \"\"" , " ee <- .tkSelectColumnMain(where, where, top.frame = top.frame, " , " preselect = preselect, background = background)" , " return()" , "}" , "", "#updated function multipleMjr()", "multipleMjr<-","function (x = \"\", y = \"SiO2,TiO2,Al2O3,FeOt,MgO,CaO,Na2O,K2O,P2O5\", " , " pch = labels$Symbol, col = labels$Colour, ...) " , "{" , " GUI <- x == \"\"" , " if (x == \"\" & package.name == \"GCDkit\" & any(colnames(WR) == " , " \"SiO2\")) " , " x <- \"SiO2\"" , " y <- colnames(WR)[!is.na(match(colnames(WR), unlist(strsplit(y, " , " \",\"))))]" , " if (length(y) > 1) " , " y <- paste(text = y, collapse = \",\")" , " else y <- \"\"" , " multiple(x, y, pch = pch, col = col, GUI = GUI)" , "}" , "", "#updated function multipleTrc()", "multipleTrc<-","function (x = \"\", y = \"Rb,Sr,Ba,Cr,Ni,La,Ce,Y,Zr,mg#,A/CNK,K2O/Na2O\", " , " pch = labels$Symbol, col = labels$Colour, ...) " , "{" , " GUI <- x == \"\"" , " if (x == \"\" & package.name == \"GCDkit\" & any(colnames(WR) == " , " \"SiO2\")) " , " x <- \"SiO2\"" , " y <- colnames(WR)[!is.na(match(colnames(WR), unlist(strsplit(y, " , " \",\"))))]" , " if (length(y) > 1) " , " y <- paste(text = y, collapse = \",\")" , " else y <- \"\"" , " multiple(x, y, pch = pch, col = col, GUI = GUI)" , "}" , "", "#updated function about()", "about<-","function () " , "{" , " message <- \"GCDkit Win 3.00 patch 130605 [5 June 2013]\\n (c) 1999-2013\\n\\nV. Janousek\\nCzech Geol. Survey\\nvojtech.janousek@geology.cz\\n\\nC. Farrow\\nex-University of Glasgow\\n\\nV. Erban\\nCzech Geol. Survey\\n\\nJ.-F. Moyen\\nUniversite Saint-Etienne\"" , " winDialog(type = \"ok\", message)" , "}" , "#end") cat(patch,file=paste(gcdx.dir,"/Patch/GCDpatch130605.r",sep=""),sep="\n") source(paste(gcdx.dir,"/Patch/GCDpatch130605.r",sep="")) }