Authors: David Zelený (firstname.lastname@example.org) & Ching-Feng Li (email@example.com)
Related website: http://www.davidzeleny.net/wiki/doku.php/codek:start
CoDeK is a software application, based on R program (www.r-project.org), which allows automatic classification of vegetation samples into vegetation types defined by Cocktail determination key. To run this application, you need the table of one or more vegetation plots (samples, relevés), file with the Cocktail determination key and optionally also species checklist, which allows checking for correct use of species nomenclature in both files of vegetation plots and Cocktail determination key.
CoDeK is basically an R script, which must be run in R program. In any case, you need to install R program on your computer; R can be downloaded for free at www.r-project.org (click here to download the most recent version of R).
The CoDeK application has been tested in R version 2.15, however, it should run also in newer R version (and probably also in older ones).
CoDeK can be launched in two ways:
Windows XP, Vista, 7 (other OS which can run R program can be probably also used, but the application has to be launched manually by copying the script in CoDeK_vX.X.r into R console). If using also JUICE, consult the http://www.sci.muni.cz/botany/juice/ website for system requirements of JUICE program.
Unzip the supplementary materials in CoDeK_vX.X.zip into your computer; directory CoDeK will be automatically created. This directory contains the following files:
Important: you need to change the file name CoDeK_bat into CoDeK.bat (i.e., replace “_” by “.”, using file manager).
Example vegetation data represent succession stages from secondary to primary subtropical lowland forest (Li 1997). Example data in txt format and JUICE format are identical (JUICE format additionally contains header data such as geographical coordinates and few environmental factors).
You need to download only the CoDeK_vX.X.r file - this is part of the archive CoDeK_vX.X.zip, or can be downloaded separately.
If you will run CoDeK directly using the batch file CoDeK.bat, to set it up you have two options:
c:\Program Files\R\R-2.12.2\bin\(don’t forget to add
bin\at the end of the directory, as the R.exe file is inside the folder bin). Note the differences between a forward slash (
/) and a backslash (
\) – the latter need to be used!
To launch the CoDeK application from JUICE program, you need to install the JUICE program first (JUICE can be operated under Windows OS (optionally other OS using Windows emulator such as Wine for Linux) and it can be downloaded at http://www.sci.muni.cz/botany/juice/?idm=3). Consult JUICE website and JUICE manual if you encounter problems while installing the program.
In JUICE, you need to setup the path to R program. In JUICE menu, go to File > Options, and choose the folder External Program Paths (Fig. 2). At the line of R Project, click on Change Path button and navigate to the directory of Rgui.exe file (if you installed R version 2.12.2, you will probably find it in the directory c:\Program Files\R\R-2.12.2\bin\, either in subfolder i386 (if you are using 32 bit version of R) or x64 (if you use 64 bit version). If you use R version older than 2.9.0, you will find Rgui.exe file directly in the folder bin, which does not contain subfolder mentioned above. Click on OK button to leave the Options. Note: in JUICE options, you MUST specify the file Rgui.exe file, not Rterm.exe or R.exe!
The table of vegetation plots contains percentage data about species relative IVI or cover; species are in rows, plots are in columns. First row contains sample names (without spaces), first column contains species names. Species names must be identical as those listed in Checklist, otherwise the Determination key may not identify the plots appropriately. CoDeK offers simple function to check compatibility between the species names in the table of vegetation plots and the Checklist. All plots stored in the file will be used for determination of vegetation types; if you wish to determine only part of the data, remove them from this file. Vegetation data should be stored in a plain text format, with cells separated by tabulator. This format can be created e.g. using Excel spreadsheet program (use the function Save as and choose Text (separated by tabulators)). For details of the format, see example_data.txt file directly (it can be opened in Notepad program or imported into Excel).
To run CoDeK from JUICE, you need to import vegetation data to JUICE program first. Spreadsheet format data (e.g. from Excel) can be imported into JUICE directly; however, note that you need to add manually three rows at the beginning of the file (for details about this, see JUICE manual, part 1, section 1.4.4 Spreadsheet Format (Microsoft® Excel® Table), which is available at JUICE website http://www.sci.muni.cz/botany/juice/ at the section Manuals). Optionally, vegetation data can be imported into JUICE from Turboveg program (Hennekens & Schaminée 2001; see JUICE manual for more details).
. Alternatively, if the CoDeK.bat file is in the folder Program Files, you may not have sufficient administrator rights to run applications within Program Files folder (this is especially true for Windows versions 8 and 10). In that case, move the CoDeK.bat and CoDeK_vX.X.r files out of Program Files directory (e.g. Documents folder); note, however, that in that case you need to modify the address to R program within CoDeK.bat file according to Program settings > Option 1, Figure 1.
After running the determination key, the *.txt file with the results of classification is created, either in CoDeK directory or the R program directory (if you use CoDeK.bat option, it will be at the same folder as CoDeK.bat file; if you use JUICE to run the key, the file will be in R program directory). The name of the file is results_of_classification-YYYYMMDD-hhmmss.txt, where YYYYMMDD-hhmmss is a time stamp (e.g. 20120402-104338, which means 2nd April 2012 at 10:43:38). Each run of determination key will produce new result file with relevant time stamp. The file can be opened in notepad, Excel or any other editing program.
After running CoDeK application, new file CoDeK.out is created (either in CoDeK directory or R program directory). This file contains technical report about the process of calculation. If error occurs, this file can serve as a reference for searching the potential bugs (follow Error or Warning messages in the file). If error occurs, first check the website http://www.davidzeleny.net/wiki/doku.php/codek:start for availability of updates of the CoDeK program or trouble shooting. In case you still experience troubles in using the CoDeK program, do not hesitate to contact us (firstname.lastname@example.org, email@example.com). Providing the CoDeK.out file (in case you run CoDeK directly) or basic.out file (in case you run CoDeK as JUICE-R function) and optionally also example of your data will greatly improve our ability to determine where the error happened.