Sunday, 21 July 2013

Installing GCDkit

Two important point to note – the source of a great many complains :

1) You must install R before installing GCDkit. I repeat – you must install R before GCDkit.

You must install R before GCDkit.

(if you don’t, GCDkit will not start properly and complain about not finding the R Gui file etc.)

(in fact it is possible, but you then need to manually load GCDkit with library(GCDkit), but most regular users will not want to go that route).

2) With the current version of GCDkit (GCDkit 3.0), you must use R2.13.1. Again : you must use R 2.13.1

If you don’t, it’s very likely that GCDkit will not work. Also, note that the current version of R is 2.15.1 at the time of writing; so if you want version 2.13, you will need to look for it on CRAN website.

Sometimes, the simplest information is the most overlooked...

Wednesday, 10 July 2013

GCDkit workshop in India, January 2013

In the June issue of the Journal  of the Geological Society of India just appeared a short article by Sita Bora and Quazi A. Rasool on our workshop 'Geochemical Modelling in Igneous Petrogenesis: An Introduction to GCDkit' which was hosted by the National Geophysical Research Institute, Hyderabad on January12–15, 2013.  It brings nice memories of a very lively meeting and spotless organization by a team led by dr. Vysetti Balaram (Hyderabad) and prof. Santosh Kumar (Nainital).

The workshop, led by Jean-Francois Moyen and myself, focussed initially on basic usage of the GCDkit system, then fundamentals of the R language and principles of geochemical modelling of the main processes in  igneous petrogenesis, such as fractional crystallization, partial melting and binary mixing, using the whole-rock major- and trace-element data and radiogenic isotopic compositions. The enjoyable and enlightening part of the meeting represented invited lectures by several leading  Indian specialists. See the original article for more details. Big thanks are due to all who made this great event to happen, as well as to participants for their eagerness and hard work!

Previous invited workshops on GCDkit (and often on geochemical modelling in the R language)

  • Czech Geological Survey, Prague (11.6. 2004),
  • TU Bergakademie Freiberg, Germany (16. 10. 2005),
  • CGS/EOST, Université Louis Pasteur Strasbourg, France (23.–24. 10 2008),
  • University of Tromso, Norway (16.–17. 6. 2010),
  • Université Jean Monnet, Saint-Etienne, France (9.–11. 5. 2011),
  • University of Helsinki, Finland (7.–11.11. 2011),
  • University of Stelenbosch, South Africa (19–23 3. 2012)

Tuesday, 25 June 2013

Making (kind of) good-looking data tables

Unavoidable task in writing up any scientific paper is to prepare a data table, or rather several of them.  You will probably agree that it quite easy to waste a lot of time trying to format such a table so that it complies with in-house rules of the given Journal or just (often worse) our own needs/wishes. Most commonly, we would like to arrange the analyses according to some key, for instance grouping together the analyses coming from the same intrusion or locality. Moreover, we may want to order the analyses within each of the groups according to an additional criterion, say the increasing silica contents. Lastly, the page width is finite and thus there is likely to be a limit on number of analyses we can fit across a page.
Fortunately the new GCDkit comes with a function which makes this ask easier. In fact, it is currently not attached to the menu system and this is exactly the moment when it is good to be a power user, i.e. not afraid to type in a few lines of code. ;-)

The function in question is called HTMLtableOrdered and outputs the data stored in the numeric matrix specified by parameter 'what'. Optional argument 'which' gives the list of sample names (rows) in the matrix to be saved. The data are first sorted based on 'key2', which typically gives a grouping information (name of a column in 'labs'). Within each of the groups, the data are further sorted based on the numeric variable 'key1'. And the number of analyses across a page is indicated by the parameter ''. For example, we can produce a table of Large Ion Lithophile Elements (LILE) from our sample datafile,
# Read in the sample data
title="LILE (ppm)",
There are some other parameters which can be included, for instance the table can have samples in rows, as we are used to from the GCDkit system, and the analyses summed up:

title="Major-element data (wt. %)",,rotate=FALSE,sum.up=TRUE)
And here is the last example, generating the table from results, here of the CIPW norm calculation.
title="CIPW norm",

I just hope you have found the today's tip useful and that it will save you some time to do something more sensible than formatting tables.......

Friday, 21 June 2013

First patch for GCDkit 3.00 released on 5 June 2013

A patch for the GCDkit 3.00 number 130605 is available, addressing following bugs:
  • Redrawing plates in plateCexLab()
  • Verma() was not working correctly for datasets with only total iron determined
  • crashing gcdOptions() (missing were some underlying TclTk functions)
  • multipleMjr() and multipleTrc() did not work at all from the command line

The newest patch installation file can be downloaded here.

Read more about GCDkit patches

Thursday, 20 June 2013

About GCDkit patches

As any other software, neither GCDkit is immune from coding bugs. For this reason, GCDkit 3.00 comes with support for patching, which allows the user to improve the program easily, without need for re-installation. There are some facts worth noticing regarding the patches, which will be documented in this spot. However, let us start with the most important:

 What to do with a GCDkit patch?

  1. Download the patch installation file from the GCDkit website (hold ALT when clicking the link to block automatic opening in your browser)
  2. Start GCDkit
  3. Drag-and-drop the installGCDpatchXXXXXX.r file from your download folder onto the R-console (the verbose GCDkit window)
If you see the "Installing the file patch XXXXXX.r" message, well, it is done.

How does the patch work

The idea is simple: Patch for GCDkit is a file containing all updated functions, stored in the Patch folder of the GDkit package. This file is read (sourced) at the end of GCDkit startup, so all the updated functions replace its previous versions.

The patch installation file is also a piece of R code, which writes the patch itself in appropriate folder when executed (or updates another GCDkit files if necessary). This implies further ways of patch installation: Besides the preferred drag-and-drop approach, the install file can be also copied into Patch folder, or its content may be copied into the R-console via clipboard.

What the patch is, and what it is not

The patches are intended to fix existing problems in GCDkit functions, or mistakes in build-in variables etc.

On the other hand, the patches are not here to bring brand new functionality or changes in the system (this will be done via plugins or even new GCDkit version). The reason is simple - the patches should bring more reliability instead of new problems. Also, plugins will not be patched.

Patch versions

Each patch has its number, mirroring the release date (YYMMDD). It is stored in the patchID variable, and it can be also viewed by clicking the GCDkit | About GCDkit menu entries, or typing about(). If the patch available from the website is newer, it is time to install.

On the other hand, each patch is cumulative so only the newest one is necessary. The installation of the GCDkit itself comes with the last patch available, so there is no need to download patches for new GCDkit installations.


If you have problems during patch installation, try another way of installing the patch, as described earlier. There may be also problems with writing rights for the Patch directory, so check the system permissions. And please let us know, even if you have solved the problem successfully (preferably in the discussion here) to help others.

There may also happen, that (despite of all our effort) the new patch will hamper somehow your (previously problem-free) work with GCDkit. To restore to previous state, go to the patch location (something like C:\Program Files\R\R-2.13.2\library\GCDkit\Patch) and delete the last patch (GCDpatchXXXXXX.r  with highest XXXXXX number). The GCDkit will get back to its previous configuration after restart. And again: let us know.

Follow us for new patches

 Unlike the GCDkit 2.3, which remained unchanged for five years in its public version, we plan to release patches for GCDkit 3 more often, generally whenever new bugs are identified and smashed. We recommend to check for new versions. The easiest way is to check this weblog (you can subscribe to its Atom feed), or follow our twitter account. Of course you can also check the website manually time by time.

Tuesday, 18 June 2013

How to introduce your own normalization scheme for spiderplots?

Many users would like to add a new normalization scheme to their  spiderplots in GCDkit, or at least to alter some normalization value or change the order of elements. It is easier than you may think.

The composition of various standards available for normalization and subsequent plotting of spiderplots is stored in the file '' in the main GCDkit directory. It is a comma delimited and may look  like this:
REE chondrite (Boynton 1984)

ORG (PearceEtAl.1984)

For each normalization scheme, there are always three rows, separated by an empty one from the previous record.

1. The first row contains the title and reference. If the title starts with 'REE', the normalization is supposed to be for REE only and special parameters, such as 'Eu/Eu*', are calculated.

2. The second line gives a comma delimited list of elements in the order they should appear on the plot.

3. The last line is a comma delimited list of normalization values. Please note that the trailing zero before decimal point is optional.

As the file '' is read every time spiderplot is drawn, the user can add or delete normalization schemes on his will using any text editor, such as Notepad. Just make sure that you keep a backup of copy of the original file somewhere safe, in case that something gets wrong.

Happy plotting!

Monday, 20 May 2013

(Nearly) complete list of changes in the GCDkit 3.0

Apart from a number of  bug fixes and  improvements  to many of the functions, the new features that have changed from the last stable release (2.3) are:
  • Plates of multiple plots, each of which can be edited in a manner previously available only for some of the stand-alone diagrams. Moreover, the properties of the whole plate or all its diagrams can be changed simultaneously,  e.g. scaling the common x axis or setting to black and white.
  • Many plotting functions redesigned so that they can be run solely from the command line, without any potentially pestering GUI dialogues. This enables their use in a batch mode and will ultimately enable writing programs running GCDkit from the command prompt  (from a text file, by an external macro, Sweave etc.)
  • New function HTMLtableOrdered, which enables to specify the width of the table (number of analyses  across the page), as well as a primary and secondary keys for their ordering.
  • Locales for classification plots (French and Czech translations of field names are provided as examples).
  • Import and export for XLSX files (32bit Windows only).
  • Naming the plotting windows for better orientation (plates require that R is installed as SDI interface, i.e. each plotting window is separate).
  • New are also persistent options that can be modified in a simple GUI and then saved to a configuration file. Upon next start, the GCDkit will e.g. remember the directory with your favourite data. 
  •  A new mechanism for distribution of patches to the GCDkit code
  • New classification diagrams:
    • Ternary plot of Na2O-Al2O3-K2O (mol. %) for judging the balance of alumina and the two alkali oxides.
  • New geotectonic diagrams:
    • Diagram of Sylvester (1989) to distinguish collision-related alkaline granites from calc-alkaline and peraluminous suites.
    • Ternary plot Hf - Rb/30 - Ta*3, proposed by Harris et al. (1986) for classification of  collisional granites.
    • Geotectonic diagrams for (ultra-) basic rocks of Verma (2006) based on natural log-transformed ratios of major and minor elements.
    • Geotectonic diagrams for (ultra-) basic rocks of Agrawal (2008) based on natural log-transformed ratios of trace elements.
    • New diagram Zr-Ti of Pearce (1982).

  • New in spiderplots:
    • New form of spiders, colour-coded according to an independent variable, such as silica contents (spider.contour).
    • Function spider2norm for production of double normalized spider plots (see the help page for advantages of this approach; this double normalization is also newly implemented in spiderboxplots.)
    • Choice of several styles of labelling x axis in spiderplot (e.g., rotated and/or offset labels).
    • Several new  normalization schemes for spiderplots were  added, including e.g. PGE.

  • Plot editing: functions to outline groups on binary and ternary plots using contours
      and convex hulls (contourGroups and chulGroups)
  • Statistics:
    • New function to plot so-called stripBoxplots - i.e. stripplots of selected parameter in individual groups, each underlain by a boxplot. Optionally also a second variable can be portrayed by various size of plotted circles.
    • Function summaryRangesbyGroup for printing ranges of selected geochemical parameters in individual groups of analyses.
  • New in plugins: 
    • Wedge diagrams and concentration ratio plots (Ague 1994) became an part of the isocon.r plugin to expand the range of tools available for addressing mass balance during open-system processes such as metasomatism, partial melting, migmatitization or metamorphism.
    • JungAlTitemp.r: New plugin implements thermometer of Jung and Pfänder (2007) based on experimentally determined Al2O3/TiO2 ratios in granitic magmas.

  • Help: links to original papers through the DOI system. Much more examples added.
See our web page  or this short paper for further details.

Monday, 13 May 2013

GCDkit version 3.0 released (at last)!

We are pleased to announce that the new stable version of GCDkit has been just released! It is a bit ashaming, but it has taken exactly five years to debug some of its revolutionary features.
First, the system enables editing plates of multiple plots, in a manner previously available only for some of the stand-alone plots.
Second is the internationalization – we have introduced dictionaries, serving for the translation of classification diagrams. Czech and French localizations are provided as an example.
Third, we  have made some important steps ahead stripping the core of the system of the (M$ Windows-specific) graphical user interface (GUI). Most of the commands can be invoked now in the batch mode, thus further speeding up otherwise tedious processing of large data files. This will ultimately enable writing programs running GCDkit from the command prompt, and potentially also design some alternative GUIs. 

The new version can load data from Excel 2007 (xlsx) files (32bit systems only!). New are also persistent options (such as directory with your favourite data) , that can be modified in a simple GUI and then saved to a configuration file. Of course, the release addresses the stability issues, improves the appearance of the plots, and brings several new diagrams and plugins.

Finally, the data file became integrated to the system. Thus the new features can be illustrated by a number of examples in the help system (viz). For example: