Skip to content

Commit

Permalink
Add Goldschmidt's classification
Browse files Browse the repository at this point in the history
  • Loading branch information
abuseki committed Aug 12, 2024
1 parent 381735a commit 9ae6463
Show file tree
Hide file tree
Showing 12 changed files with 182 additions and 11 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: georefdatar
Title: Geosciences Reference Datasets
Version: 0.6.5.9001
Version: 0.6.5.9002
Authors@R:
person("Gerald", "Schuberth-Hlavač", email= "abuseki@synapticgap.com",
role = c("aut", "cre"))
Expand All @@ -18,7 +18,7 @@ URL: https://github.com/abuseki/georefdatar
BugReports: https://github.com/abuseki/georefdatar/issues
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
Depends:
R (>= 2.10)
LazyData: true
Expand Down
19 changes: 12 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
# georefdatar (development version)

## georefdatar 0.6.5.9002

Added the Goldschmidt's classification of the elements
(litho-, chalco-, sidero- and atmophile) to the element sets.

## georefdatar 0.6.5.9001

* Changed the mineral list from using the RRUFF list to using the list in the
supplementary material of Warr (2021).\
The Warr (2021) list also includes group names. This makes it more practical
for use in a general earth science context, where one often wants to or needs
to refer to a group of minerals. E.g. amphibol, biotite, pyroxene, ...\
In the RRUFF list these groups are not mentioned because the are not minerals,
strictly speaking.
Changed the mineral list from using the RRUFF list to using the list in the
supplementary material of Warr (2021).\
The Warr (2021) list also includes group names. This makes it more practical
for use in a general earth science context, where one often wants to or needs
to refer to a group of minerals. E.g. amphibole, biotite, pyroxene, ...\
In the RRUFF list these groups are not mentioned because the are not minerals,
strictly speaking.

# georefdatar 0.6.5

Expand Down
59 changes: 59 additions & 0 deletions R/elementSets.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,62 @@
#' @describeIn PGE Pd-PGE subgroup
#' @format character vector with `r length(PPGE)` elements.
"PPGE"



#' Goldschmidt's classification of the elements
#'
#' @description
#' Sets containing the elements classified after Goldschmidt.
#'
#' @details
#' The geochemical behavior of the elements is controlled by many factors (e.g.
#' ionic radius, volatility, redox, ...). Therefore, the elements can be
#' classified in several ways. A common classification scheme is that developed
#' by _V. M. Goldschmidt_, which is based on the affinity of elements to form
#' different types of compounds. The Elements are characterized as:
#'
#' 1. **lithophile** (rock-loving): elements with a strong affinity for forming
#' oxides and silicate minerals.
#' 1. **chalcophile** (copper-loving): elements with a strong affinity for
#' forming sulfides.
#' 1. **siderophile** (iron-loving): elements with a strong affinity to form
#' metals or solid solutions in metals.
#' 1. **atmophile** (air-loving): elements that exist either uncombined or as
#' highly volatile compounds.
#'
#'
#' @references
#' \insertRef{Marshall1999}{georefdatar}
#' @importFrom Rdpack reprompt
#'
#' @examples
#' # List the atmophile elements
#' Atmophile
#'
#' # Show the electron configuration of the atmophile elements
#' pte[pte$Symbol %in% Atmophile, c("Symbol", "ElectronConfiguration")]
#'
#' @name Goldschmidt
NULL

#' @rdname Goldschmidt
#' @order 1
#' @format `Lithophile`: character vector with `r length(Lithophile)` elements.
"Lithophile"

#' @rdname Goldschmidt
#' @order 2
#' @format `Chalcophile`: character vector with `r length(Chalcophile)` elements.
"Chalcophile"

#' @rdname Goldschmidt
#' @order 3
#' @format `Siderophile`: character vector with `r length(Siderophile)` elements.
"Siderophile"

#' @rdname Goldschmidt
#' @order 4
#' @format `Atmophile`: character vector with `r length(Atmophile)` elements.
"Atmophile"

Binary file added data-raw/GeochemClass__EncyGeoChem__Tab_G4.xlsx
Binary file not shown.
23 changes: 22 additions & 1 deletion data-raw/elementSets.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## code to prepare `elemSet` dataset goes here
# code to prepare `elemSet` dataset goes here

## REE
Lanthanides <- c('La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb', 'Lu')
Expand All @@ -23,3 +23,24 @@ usethis::use_data(REM, overwrite = TRUE)
usethis::use_data(PGE, overwrite = TRUE)
usethis::use_data(IPGE, overwrite = TRUE)
usethis::use_data(PPGE, overwrite = TRUE)


## Goldschmidt
t <- readxl::read_xlsx('data-raw/GeochemClass__EncyGeoChem__Tab_G4.xlsx')
# Add Symbol to element name since we want the symbols for the elements and not
# their names
t$Symbol <- unlist(lapply(t$Element, function(e) {pte[pte$Name==e,]$Symbol}))

# Build the element sets
Atmophile <- subset(t, t$Goldschmidt=="Atmophile" |
t$Goldschmidt=="Atmophile/Lithophile")$Symbol
Chalcophile <- subset(t, t$Goldschmidt=="Chalcophile")$Symbol
Lithophile <- subset(t, t$Goldschmidt=="Lithophile" |
t$Goldschmidt=="Atmophile/Lithophile")$Symbol
Siderophile <- subset(t, t$Goldschmidt=="Siderophile")$Symbol

# save the data
usethis::use_data(Atmophile, overwrite = TRUE)
usethis::use_data(Chalcophile, overwrite = TRUE)
usethis::use_data(Lithophile, overwrite = TRUE)
usethis::use_data(Siderophile, overwrite = TRUE)
Binary file added data/Atmophile.rda
Binary file not shown.
Binary file added data/Chalcophile.rda
Binary file not shown.
Binary file added data/Lithophile.rda
Binary file not shown.
Binary file added data/Siderophile.rda
Binary file not shown.
5 changes: 5 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CPKHexColor
CaO
Chondrite
Chronostratigraphic
chronostratigraphic
ElectronAffinity
ElectronConfiguration
Electronegativity
Expand Down Expand Up @@ -62,3 +63,7 @@ IUPAC
CNMNC
CIAAW
CMD
Warr
Goldschmidt
pyroxene
amphibole
60 changes: 60 additions & 0 deletions man/Goldschmidt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 22 additions & 1 deletion tests/testthat/test-elementSets.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_that("elementSets works", {
test_that("REE and Co works", {

expect_true(all(
length(Lanthanides) == 15,
Expand Down Expand Up @@ -33,3 +33,24 @@ test_that("elementSets works", {
)

})


test_that("Goldscmidt works", {
expect_setequal(Atmophile,
c('H', "He", "N", "Ne", "Ar", "Kr", "Xe", "Rn", "C", "O")
)
expect_setequal(Chalcophile,
c('S', 'Cu', 'Zn', 'Ga', 'As', 'Se', 'Ag', 'Cd', 'In', 'Sb',
'Te', 'Hg', 'Tl', 'Pb', 'Bi')
)
expect_setequal(Lithophile,
c('Li', 'Be', 'B', 'C', 'O', 'F', 'Na', 'Mg', 'Al', 'Si', 'P',
'Cl', 'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Br', 'Rb',
'Sr', 'Y', 'Zr', 'Nb', 'I', 'Cs', 'Ba', 'La', 'Ce', 'Pr',
'Nd', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 'Yb',
'Lu', 'Hf', 'Ta', 'Th', 'U')
)
expect_setequal(Siderophile, c('Fe', 'Co', 'Ni', 'Ge', 'Mo', 'Ru', 'Rh', 'Pd',
'Sn', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au')
)
})

0 comments on commit 9ae6463

Please sign in to comment.