Tuesday, 21 May 2019

Drop label and group axes

On occasion one might load a data set where the labels consist of several levels of the Linnean hierarchy, e.g. the name of a label will be made up of order, family, genus, species and subspecies.  Or you might have packed in extra information for debugging, or you have population ID included.

However, sometimes you want to simplify the records and use them at an different level.  For example, you might want to collapse your genus:species data to the genus level, or remove population and family details.

You might also have generated group names using geographic coordinates, plus additional details about time or region (see Stephenson  et al. 2015 and Laffan et al. 2013 for examples of those), but then want to remove the region or time axes.

One approach is to export the data (labels or groups) and then reimport them using only the axes you need, but this can be tedious as it involved several steps.  You could also use the rename interface with a remap table, but setting up the table can also be tedious.

From Version 3 it can be done directly within Biodiverse.

Some screenshots are probably the best way to explain it.  See captions for details.

The data in this case were used in Cassis et al. (2017) and consist of details downloaded from the Atlas of Living Australia .  Each label comprises the family, genus, scientific name and taxonomic level, joined using a colon (the standard join character used in Biodiverse).  This last column (axis) made it easier to remove records that were not at the species level, but is not needed for many analyses.  All these columns also make it hard to link the data to phylogenies.  (Note that they have no effect on indices like taxon endemism, rarity and richness, as those only need to work with unique identifiers).

Each label comprises four axes of information.  This can be useful, but not for everything.  

The process is done through one of the duplication options.  There is no undo, so it is safer to generate a new data set.

Unsurprisingly, the new basedata needs a name.

The system can work with either groups or labels.  If you need to trim axes from both then run it twice, once for groups and once for labels.  

Select which axes you wish to drop.  In this case only the scientific name will be retained.  Note that the axes are numbered from zero, which is common for many programming languages (but not for R).  

And here are the data with simplified labels.  Note that if, two or more labels collapse down to the same name then their sample counts are merged.  

And that's pretty much it.

The same process applies to groups so there are no screenshots provided for them.

Shawn Laffan

If you want to try this out before version 3 is released then the 2.99_004 (or later) development release can be accessed through the downloads page at https://github.com/shawnlaffan/biodiverse/wiki/Downloads


For more details about Biodiverse, see http://shawnlaffan.github.io/biodiverse

To see what Biodiverse has been used for, see https://github.com/shawnlaffan/biodiverse/wiki/PublicationsList

You can also join the Biodiverse-users mailing list at http://groups.google.com/group/Biodiverse-users

No comments:

Post a comment

Note: only a member of this blog may post a comment.