We’re going to work on the TGA.txt file, which contains the TGA of an aqueous solution of single-walled carbon nanotubes individualized by the addition of polymers and surfactants. What we want to know is:


1. Knowing all this, let’s import the data into a dataframe called tga:


2. This data is made up of 5 columns:

Before any further processing, we need to take a look at our data. Using ggplot2, plot the Mass column against the Tread column using a black line and formatting the axis texts to show the units. Is there a problem? Check out what geom_path() will do.


3. You can see from this representation that some data ranges are to throw away: the cooling section, and the vertical drop at the start - this is due to the fact that the sample was in a sample changer, and lost water while waiting for the measurement to start.

So, modify tga to remove these two data ranges, and plot it again.


4. Finally, in TGA, we’re interested in mass variation, not absolute mass.


5. Now plot the percentage of mass remaining as a function of temperature, zooming in on the part we’re interested in (i.e. not solvent evaporation).


6. As mentioned above, this is a sample of single-walled carbon nanotubes individualized by the addition of polymers and surfactants. What we want to know is:

In ATG, the decomposition temperature of a compound is said to be reached when the ATG curve reaches an inflection point. Determining the position of these inflection points is done by determining the position of the local extrema in the first derivative of the curve.

Using the diff() function, implement a derivative(x,y) function that returns the first derivative \(\partial y/\partial x\) given two vectors x and y. Make this function return a dataframe with column names x and y.

Then, use this function to calculate d_tga, the derivative of RemainingMass with respect to Tread for Tread>150.


7. We will now determine the position of the local minima and save them in an inflpoints list.

To do this, use this thread on stackoverflow. We want to keep only the inflection points below 400˚C, and as the derivative curve is noisy we’ll use the span=150 parameter to work on smoothed data (you can play with this parameter to see its effects).


8. Now try to reproduce the graph below (without “hardcoding” any values, of course!):