Mantle + E-MORB, N-MORB, OIB
Reference | Sun, S-S, McDonough, WF Chemical and isotopic systematics of oceanic basalts: implications for mantle composition and processes, 1989 [ref] |
Data | bulk |
Input | ppm |
require('ggplot2'); cmp <- read.csv("constants_oceanic_basalts_compositions.csv", sep=";", stringsAsFactors=F); ocean <- read.csv("constants_oceanic_basalts_compositions.csv", sep=";", stringsAsFactors=F); spdgrams.ree_primitive_mantle_wm_sun <- function(ppm_data, el_order = NULL) { ns <- el_order; if (is.null(el_order)) { ns <- c('Cs', 'Rb', 'Ba', 'Th', 'U', 'Nb', 'Ta', 'La', 'Ce', 'Pb', 'Pr', 'Sr', 'Nd', 'Zr', 'Hf', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Y', 'Ho', 'Er', 'Tm', 'Yb', 'Lu'); } pmsc <- c(); for (n in ns) pmsc <- c(pmsc, subset(cmp, element == n)$primitive_mantle); nmorb <- c(); emorb <- c(); oib <- c(); for (n in ns) { if(n %in% ocean$element) { nmorb <- c(nmorb, subset(ocean, element == n)$N_MORB); emorb <- c(emorb, subset(ocean, element == n)$E_MORB); oib <- c(oib, subset(ocean, element == n)$OIB); } else { nmorb <- c(nmorb,0.0); emorb <- c(emorb,0.0); oib <- c(oib,0.0); } } cr <- data.frame(rbind(nmorb,emorb,oib)); names(cr) <- c(paste0(ns,'_ppm')); print(cr); ds <- selectNames(ppm_data,c(paste0(ns,'_ppm'))); print(ds); ds <-rbind(ds,cr); names(ds) <- ns; print(ds); ret <- c(); values <- cbind(c(ppm_data$Name, "N-MORB", "E-MORB", "OIB"), rowApply(`/`,ds,pmsc)); names(values)[1] <- 'Name'; print(values); ret$values <- values; ret$grades <- ns; ret$labels <- c('REE', 'Sample/Primitive Mantle'); return(ret); } spdgrams.ree_primitive_mantle_wm_sun.test <- function() { spdgrams.ree_primitive_mantle_wm_sun(data.frame(Name=c('Test'),Eu_ppm=c(34.5))); }