spdg: spdg: spider diagram generator

View source: R/spdg.R

spdgR Documentation

spdg: spider diagram generator

Description

"spdg" is a useful function to draw spider diagrams of trace/REE elements. This function allows us to extract only which kinds of elements you need from your dataset, and to plot their concentrations.

Usage

spdg(elist, s, nml, plottype, output)

Arguments

elist

a vector which determines which kinds/order of elements you would like to adopt. You cannot set values other than "Cs", "Tl", "Rb", "Ba", "W", "Th", "U", "Nb", "Ta", "K", "La", "Ce", "Pb", "Pr", "Mo", "Sr", "P", "Nd", "F", "Sm", "Zr", "Hf", "Eu", "Sn", "Sb", "Ti", "Gd", "Tb", "Dy", "Li", "Y", "Ho", "Er", "Tm", "Yb", and "Lu". This is because the reference values, by which we normalize the sample data, consist only of concentrations of these elements.

s

a compositional dataframe. The first column should be a vector of elemental names, and the other columns should be their concentrations (ppm) in your samples. It is recommended to name each of the columns (i.e., each of the samples).

nml

a name of the reference dataset you would like to use: "NMORB_SM89", "EMORB_SM89", and "OIB_SM89": N-MORB, E-MORB, and OIB values (Sun and McDonough, 1989); "CI_MS95", "PM_MS95": chondritic and pyrolite mantle values (McDonough and Sun, 1995).

plottype

the type of line plots. You can choose from "l", "o", "b", etc.

output

If output = TRUE, you can obtain a text file which includes the final dataset used for the plot in the working directory.

Note

> This function works well even if the dataset ("s") includes NA values and/or undefined elemental names (e.g., SiO2, MgO, etc.), and/or even if the dataset lacks elemental names which are defined in the "elist" vector.

> Even if you set a dataset for many samples, this function can process it. However, as we have prepared only 10 colors and 2 line types, too many sample data would be indistinguishable on the plot.

> If you already have "output.txt" in the working directory, this function overwrites it when output = TRUE. The output file can be readily read with the read.table() function. Note that the output file does not contain any information about the reference dataset which was used for the normalization.

Author(s)

Ryo Fukushima

References

Sun SS, McDonough WF (1989) Chemical and isotopic systematics of oceanic basalts: implications for mantle composition and processes. Geological Society, London, Special Publications, 42:313-345

McDonough WF, Sun SS (1995) The composition of the Earth. Chemical geology, 120:223-253

Examples

spdg(elist = c("Cs","Rb","Ba","Th","U","Nb","K","La","Ce","Pb","Pr","Sr","P",
"Nd","Zr","Sm","Eu","Ti","Dy","Y","Yb","Lu"), s = example_data_GCtools,
nml = "CI_MS95", plottype = "o", output = FALSE)

Ryo-fkushima/GCtools documentation built on April 17, 2023, 3:38 p.m.