Theory, Examples & Exercises
This is an old revision of the document!
I created an experimental R library
twinspanR with the TWINSPAN algorithm - you may install it from GitHub repository (note: this library is currently in beta stage under development, and some parts may not be functional). To install any library from GitHub, you will need to first install the package
devtools written by Hadley Wickham, which contains a set of tools for development of R packages. After installing
devtools, use the function
install_github. Note that the use of the library has some limitations: it can be installed only on Windows platform (since the engine of the library is based on running *.exe file externally) and you need a permanent access to the folder where the library is installed (usually in Program Files/R/R-x.x.x/library, but could be also in some other personalized place). Without the access to this folder the function
twinspan cannot run correctly.
For more details see my blog post.
install.packages ('devtools') devtools::install_github("zdealveindy/twinspanR")
Run TWINSPAN example1), which shows modified TWINSPAN on traditional Ellenberg's Danube meadow dataset, projected on DCA ordination diagram and compared with original classification into three vegetation types (plus one not-classified releve) made by tabular sorting:
library (twinspanR) library (vegan) data (danube) res <- twinspan (danube$spe, modif = TRUE, clusters = 4) k <- cut (res) dca <- decorana (danube$spe) par (mfrow = c(1,2)) ordiplot (dca, type = 'n', display = 'si', main = 'Modified TWINSPAN') points (dca, col = k) for (i in c(1,2,4)) ordihull (dca, groups = k, show.group = i, col = i, draw = 'polygon', label = TRUE) ordiplot (dca, type = 'n', display = 'si', main = 'Original assignment\n (Ellenberg 1954)') points (dca, col = danube$env$veg.type) for (i in c(1:3)) ordihull (dca, groups = danube$env$veg.type, show.group = unique (danube$env$veg.type)[i], col = i, draw = 'polygon', label = TRUE)
example (twinspan)- this will run the example which comes with the help file of
twinspanfunction (see the section Examples in