Software

How to reconcile clam and rbacon input files

As palaeoecologist, I work on data retrieved from natural archives, going back in time. It can be a lake sediment core or peat. The time scale of the data, actually, is built by interpolation of a few radiocarbon dates, measured at particular places along the core. This creates an age-depth model. I routinely use two R packages from Maarten Blaauw to do this:

  • clam, for classical age-modelling,
  • and rbacon, for Bayesian accumulation (and it’s an R package, obviously).

Each package defines its own function (clam() and Bacon(), respectively) which only needs the name of the core, to find a CSV file on your computer with the same name. This is in this CSV file that one saves the results of the radiocarbon datings to use them with either clam or rbacon. However, each package expects the data to be presented in a slightly different fashion. But in a file having the same name. Computers don’t allow that. And sometimes, I want to be able to use either clam or rbacon.

Continue reading →
Posted by Benjamin in Lab Notes, Software, 0 comments

Quality Control of Pollen Data at a Glance

I am currently augmenting the pollen data from two sites I studied during my PhD research, thanks to a grant from the Swiss Foundation for Alpine Studies. The one I’m dealing with at the moment is a small peat bog at a locality called Saglias, near the village of Ardez in the Grisons, Switzerland.

I usually seek for high quality and reliability of palynological data. Depending on the context, I try to identify about 1000 pollen grains per sample, or 500 tree pollen grains, and look at the taxa accumulation curve. These two indices are easily accessible in real-time counting thanks to PolyCounter, the software I’m using.

Now, some samples clearly want to drive analysts crazy. Most often they contain very few pollen grains. A typical reason for this is a poor pollen preservation. It can be useful to have a closer look at them and see if there is something one can do to improve the situation. I’m doing this by looking at a few other parameters. Again, PolyCounter is your best friend. That’s easy to import the count data and metadata (such as the number of marker spiked added) into R and compute variables to address key questions:

Continue reading →
Posted by Benjamin in Lab Notes, Software, 0 comments

How to produce a stacked plot of radiocarbon date density probabilities

Since introduced by the middle of 20th century, radiocarbon dating has been used in a large variety of disciplines. In palaeoecology, it has allowed for a major improvement in dating past phenomena. The ground principle is fairly simple: the isotope 14 of carbon (14C) is radioactive and decays following one criterion, namely the half-life. The half-life means the time necessary for the original quantity to reduce to half. For 14C, it is about 5730 years!

Living organisms, just like you, accumulate carbon in their tissues all life long. This includes a certain proportion of radioactive carbon as well, but don’t be afraid, you don’t bare any risk 🙂 This proportion is kept similar to the atmospheric level of radioactive carbon, but by the death of an organism, it is not renewed anymore and starts to decay. Half of it, every 5730 years. Therefore, if you can measure how much of radiocarbon is left in a sample today and how much of non-radioactive carbon it contains, you can use its half-life, do the reverse maths and deduce the date of this (sad) event.

Continue reading →
Posted by Benjamin in Lab Notes, Software, 0 comments

LaTeX, then pandoc

I write manuscripts with LaTeX. Yes, it might old-fashioned, compared to Markdown—which I also use—but it fits my needs. I appreciate its handling of references (I mean, from the literature), and of the cross-references. Figure 1 always means figure 1! Unfortunately, I am a bit of an outlier in my discipline, biology, to keep it general. All my colleagues I’m supposed to write manuscripts with rely and the good old Word.

Continue reading →
Posted by Benjamin in Software, 0 comments

Fast and lazy replacement in Excel

During every-day data wrangling, I often have to find and replace elements in Excel. This particularly happens when I open CSV and text files generated with R. Because French locales (and many others) use a comma as a decimal mark, Excel doesn’t recognise it in such files on my French-set system, and considers these values as text. Unfortunately, this prevents me from making quick checks with formulas…

Continue reading →
Posted by Benjamin in Software, 0 comments

stabiliseR, take 2

Some time ago I presented you a software to better estimate how relient palynological counting data can be, which I called stabiliseR. I’ve been working on a slightly different approach to represent the same information, and make it more appealing. I came to this animated bar chart:

As you can see, each taxa proportion gets closer to its final value as the total count increases, and variations tend to decrease. The tidyverse and ggplot approach/magic made it very easy to impletement. You first need the gganimate package and then to include a frame argument in your plot’s aesthetics.

This will create a normal plot, ignoring the frame argument. But the gganimate() function can actually understand what it means:

This will create a GIF in your working directory with as many different frames as values in the variable_to_animate provided to the frame argument. It’s that easy!

Posted by Benjamin in Software, 0 comments

Follow a project's progress

As the end of a projet is getting closer, it is often time to show synthesis of the work achieved. For every project I’m dealing with, I keep up-to-date a (simple) Excel file of the samples I collected and analysed, but I thought about a nifty graph that could get the job done in a nicer way 🙂

Continue reading →
Posted by Benjamin in Software, 0 comments

Learning Qt

One year ago, I told a friend—who happens to be an expert in computer science—I have a dream project. I would like to create my own software. After defining my needs and strategy, he advised me to look for Qt. Qt is a language (C++-based) and environment for software and user interface development.

Recently, after a couple of frustrating experiences with the current solutions, I took the time and started to learn with language, thanks to video tutorials from ProgrammingKnowledge. So far I’ve learnt how to display text on the user interface, how to add push buttons, check and radio boxes, how to interact with user using dialogs, how to create menu options, and how to arrange all that in specific layouts and multiple views. The basic for building a user interface. Now, I need to learn the data handling that a software has to do at some point.

I’ll let you know about the progress 🙂 The big question is, what is this secret software I want to build…

Posted by Benjamin in Software, 0 comments