Title: | Compare Detrital Zircon Suites |
---|---|
Description: | Compare detrital zircon suites by uploading univariate, U-Pb age, or bivariate, U-Pb age and Lu-Hf data, in a 'shiny'-based user-interface. Outputs publication quality figures using 'ggplot2', and tables of statistics currently in use in the detrital zircon geochronology community. |
Authors: | Magnus Kristoffersen [aut, cre] |
Maintainer: | Magnus Kristoffersen <[email protected]> |
License: | GPL-3 |
Version: | 0.3.1 |
Built: | 2024-10-29 03:45:53 UTC |
Source: | https://github.com/magnuskristoffersen/detzrcr |
Calculate slope and intercept
calc_ab(t2, t1)
calc_ab(t2, t1)
t2 |
upper intercept |
t1 |
lower intercept |
Calculate the 1d density of U-Pb age data using KDE or PDD.
calc_dens(dat, bw = 30, type = "kde", age_range = c(0, 4560))
calc_dens(dat, bw = 30, type = "kde", age_range = c(0, 4560))
dat |
data.frame containing at least ages and percentage of discordancy |
bw |
Bandwidth |
type |
Type to calculate 'kde': proper KDE; 'pdd': detrital zircon PDD |
age_range |
Range over which to calculate density |
Density
Calculates 1d density of age data and scales it so that it can be plotted in the same plot of a histogram of the age data
calc_dens_hist( dat, binwidth = 50, bw = 30, type = "kde", age_range = c(0, 4560) )
calc_dens_hist( dat, binwidth = 50, bw = 30, type = "kde", age_range = c(0, 4560) )
dat |
data.frame |
binwidth |
Histogram binwidth |
bw |
Density bandwidth |
type |
'kde': KDE; 'pdd': detrital zircon PDD |
age_range |
Age range to calculated density over |
Returns density
Calculate confidence bands for ecdfs using the Dvoretzky-Kiefer-Wolfowitz inequality.
calc_dkw(dat, column = "age", alpha = 0.05)
calc_dkw(dat, column = "age", alpha = 0.05)
dat |
data.frame |
column |
which column to use |
alpha |
Desired alpha level |
data.frame with ecdf and confidence bands
Dvoretzky, A., Kiefer, J., Wolfowitz, J., 1956. Asymptotic Minimax Character of the Sample Distribution Function and of the Classical Multinomial Estimator. Ann. Math. Stat. 27, 642-669. doi:10.1214/aoms/1177728174
Calculates the initial 176Hf/177Hf values, the initial epsilon hafnium values, the model age using the measured 176Lu/177Hf value and the model age assuming the parental magma was produced from an average continental crust (176Lu/177Hf = 0.015) that originally was derived from the depleted mantle (Griffin, 2004).
calc_hf(dat, constants)
calc_hf(dat, constants)
dat |
data.frame, list or matrix of hafnium values |
constants |
vector of constants which must be in the order decay constant 176Lu, 176/177Hf CHUR, 176Lu/177Hf CHUR, 176/177Hf DM, 176Lu/177Hf DM and 176Lu/177Hf value used for two-stage depleted mantle model age calculations |
Bouvier, A., Vervoort, J.D. & Patchett, P.J. 2008. The Lu-Hf and Sm-Nd isotopic composition of CHUR: Constraints from unequilibrated chondrites and implications for the bulk composition of terrestrial planets. Earth And Planetary Science Letters 273(1-2), 48-57.
Griffin, W., Belousova, E., Shee, S., Pearson, N. and O'Reilly, S. 2004. Archean crustal evolution in the northern Yilgam Craton: U-Pb and Hf-isotope evidence from detrital zircons. Precambrian Research, 231-282.
Soderlund, U., Patchett, J., Vervoort, J. & Isachsen, C. 2004. The Lu-176 decay constant determined by Lu-Hf and U-Pb isotope systematics of Precambrian mafic intrusions. Earth And Planetary Science Letters 219(3-4), 311-324.
Calculate 1-O
calc_o_param(dat1, dat2, column, alpha = 0.05, digits = 2)
calc_o_param(dat1, dat2, column, alpha = 0.05, digits = 2)
dat1 |
data.frame |
dat2 |
data.frame |
column |
string of name of column to use ('age' or 't_dm2') |
alpha |
alpha level |
digits |
number of digits |
1-O
Andersen, T., Elburg, M., Cawthorn-Blazeby, A., 2015. U-Pb and Lu-Hf zircon data in young sediments reflect sedimentary recycling in eastern South Africa. J. Geol. Soc. London. 2006-2015. doi:10.1144/jgs2015-006
Calculate intercepts and associated p-value
calc_p_apply(dat, t2, t1)
calc_p_apply(dat, t2, t1)
dat |
data.frame |
t2 |
upper intercept age |
t1 |
lower intercept age |
Split up data.frame by sample-column and calculate quantiles
calc_quantiles(dat, column = "t_dm2", alpha = 0.05, type = 8)
calc_quantiles(dat, column = "t_dm2", alpha = 0.05, type = 8)
dat |
data.frame |
column |
which column in data.frame to use |
alpha |
alpha-level (not yet used) |
type |
type of quantile calculation (passed on to stats::quantile) |
Check the concordancy of the U-Pb data and return the data within the desired discordancy limit.
check_conc(dat, disc_lim = 10)
check_conc(dat, disc_lim = 10)
dat |
data.frame containing at least ages and percentage of discordancy |
disc_lim |
Discordancy limit |
Concordant data
Combine two square matrices
combine_matrices(mat1, mat2)
combine_matrices(mat1, mat2)
mat1 |
Matrix for upper triangle |
mat2 |
Matrix for lower triangle |
Calculate U235 at given age
concX(age)
concX(age)
age |
input age |
Calculate U238 at given age
concY(age)
concY(age)
age |
input age |
Gaussian mixing model for detrital zircon data, using lower quantile upper quantile plot
dzr_mix(mu1, sig1, mu2, sig2)
dzr_mix(mu1, sig1, mu2, sig2)
mu1 |
first mean |
sig1 |
first standard deviation |
mu2 |
second mean |
sig2 |
second standard deviation |
dzr_mix(500, 50, 1000, 100)
dzr_mix(500, 50, 1000, 100)
Find maxima.
find_maxima(dist, xmin, inc)
find_maxima(dist, xmin, inc)
dist |
distribution. |
xmin |
minimum value of distribution. |
inc |
increment. |
Find the maximum value for histogram plotting.
find_plot_max(x, accuracy = 100)
find_plot_max(x, accuracy = 100)
x |
vector of values |
accuracy |
round to nearest |
Find the minimum value for histogram plotting.
find_plot_min(x, accuracy = 100)
find_plot_min(x, accuracy = 100)
x |
vector of values |
accuracy |
round to nearest |
find_plot_min
and find_plot_max
Find the minimum and maximum values for histogram plotting.
find_plot_min_max(x, accuracy = 100)
find_plot_min_max(x, accuracy = 100)
x |
Age data |
accuracy |
Round to nearest |
Returns vector of minimum and maximum plotting values
Calculate CHUR and DM lines used for epsilon-Hf vs. age and 176/177Hf vs. age plots.
hf_lines(range = c(0, 4560), plot_type = "ehf", constants)
hf_lines(range = c(0, 4560), plot_type = "ehf", constants)
range |
range over which to calculate lines |
plot_type |
'ehf' = epsilon-Hf; any thing else gives 176/177Hf |
constants |
vector of constants which must be in the order decay constant 176Lu, 176/177Hf CHUR, 176Lu/177Hf CHUR, 176/177Hf DM and 176Lu/177Hf DM |
Griffin, W., Pearson, N., Belousova, E., Jackson, S., van Achterbergh, E., O'Reilly, S. and Shee, S. 2000. The Hf isotope composition of cratonic mantle: LAM-MC-ICPMS analysis of zircon megacrysts in kimberlites. Geochimica et Cosmochimica Acta 64(1), 133-147.
Soderlund, U., Jonathan Patchett, P., Vervoort, J.D. and Isachsen C.E. 2004. The 176Lu decay constant determined by Lu-Hf and U-Pb isotope systematics of Precambrian mafic intrusions. Earth and Planetary Science Letters 219, 311-324.
Bouvier, A., Vervoort, J.D. and Jonathan Patchett P. 2008. The Lu-Hf and Sm-Nd isotopic composition of CHUR: Constraints from unequilibrated chondrites and implications for the bulk composition of terrestrial planets. Earth and Planetary Science Letters 273, 48-57.
176Hf/177Hf value of CHUR.
hfhf_chur
hfhf_chur
An object of class numeric
of length 1.
Bouvier, A., Vervoort, J.D. and Jonathan Patchett P. 2008. The Lu-Hf and Sm-Nd isotopic composition of CHUR: Constraints from unequilibrated chondrites and implications for the bulk composition of terrestrial planets. Earth and Planetary Science Letters 273, 48-57.
176Lu/177Hf value of DM.
hfhf_dm
hfhf_dm
An object of class numeric
of length 1.
Griffin, W., Pearson, N., Belousova, E., Jackson, S., van Achterbergh, E., O'Reilly, S. and Shee, S. 2000. The Hf isotope composition of cratonic mantle: LAM-MC-ICPMS analysis of zircon megacrysts in kimberlites. Geochimica et Cosmochimica Acta 64(1), 133-147.
Decay constant of 176Lu.
lambda_lu
lambda_lu
An object of class numeric
of length 1.
Soderlund, U., Jonathan Patchett, P., Vervoort, J.D. and Isachsen C.E. 2004. The 176Lu decay constant determined by Lu^Hf and U^Pb isotope systematics of Precambrian mafic intrusions. Earth and Planetary Science Letters 219, 311-324.
Decay constants of 235U.
lambda_u235
lambda_u235
An object of class numeric
of length 1.
Steiger, R. & Jager, E. 1977. SUBCOMMISSION ON GEOCHRONOLOGY - CONVENTION ON USE OF DECAY CONSTANTS IN GEOCHRONOLOGY AND COSMOCHRONOLOGY. Earth And Planetary Science Letters 36(3), 359-362.
Decay constants of 238U.
lambda_u238
lambda_u238
An object of class numeric
of length 1.
Steiger, R. & Jager, E. 1977. SUBCOMMISSION ON GEOCHRONOLOGY - CONVENTION ON USE OF DECAY CONSTANTS IN GEOCHRONOLOGY AND COSMOCHRONOLOGY. Earth And Planetary Science Letters 36(3), 359-362.
176Lu/177Hf value of CHUR.
luhf_chur
luhf_chur
An object of class numeric
of length 1.
Bouvier, A., Vervoort, J.D. and Jonathan Patchett P. 2008. The Lu-Hf and Sm-Nd isotopic composition of CHUR: Constraints from unequilibrated chondrites and implications for the bulk composition of terrestrial planets. Earth and Planetary Science Letters 273, 48-57.
176Lu/177Hf value of DM (Griffin et al., 2000) recalculated to the decay constant of Soderlund et al. (2004) and the CHUR values of Bouvier et al. (2008).
luhf_dm
luhf_dm
An object of class numeric
of length 1.
Griffin, W., Pearson, N., Belousova, E., Jackson, S., van Achterbergh, E., O'Reilly, S. and Shee, S. 2000. The Hf isotope composition of cratonic mantle: LAM-MC-ICPMS analysis of zircon megacrysts in kimberlites. Geochimica et Cosmochimica Acta 64(1), 133-147.
176Lu/177Hf value of average continental crust.
luhf_zrc
luhf_zrc
An object of class numeric
of length 1.
Griffin, W., Belousova, E., Shee, S., Pearson, N. and O'Reilly, S. 2004. Archean crustal evolution in the northern Yilgam Craton: U-Pb and Hf-isotope evidence from detrital zircons. Precambrian Research, 231-282.
Produce data.frame of 1-O matrix suitable for geom_tile
make_tiling(dat, type)
make_tiling(dat, type)
dat |
data.frame |
type |
What to calculate |
Detrital zircon U-Pb age and Lu-Hf data from the Natal Group, KwaZulu-Natal, South-Africa (Kristoffersen et al. 2016).
Used as example of proper format of a csv-file for input in the shiny interface.
Kristoffersen, M., Andersen, T., Elburg, M.A., Watkeys, M.K., 2016. Detrital zircon in a supercontinental setting: locally derived and far-transported components in the Ordovician Natal Group, South Africa. J. Geol. Soc. London. 173, 203-215. doi:10.1144/jgs2015-012
Populate matrix with age 1-O
o_param_matrix_age(dat, alpha = 0.05, digits = 2)
o_param_matrix_age(dat, alpha = 0.05, digits = 2)
dat |
data.frame |
alpha |
alpha level |
digits |
number of digits |
matrix of 1-O for ages
Andersen, T., Elburg, M., Cawthorn-Blazeby, A., 2015. U-Pb and LuHf zircon data in young sediments reflect sedimentary recycling in eastern South Africa. J. Geol. Soc. London. 2006-2015. doi:10.1144/jgs2015-006
Populate matrix with model age 1-O
o_param_matrix_tdm(dat, alpha = 0.05, digits = 2)
o_param_matrix_tdm(dat, alpha = 0.05, digits = 2)
dat |
data.frame |
alpha |
alpha level |
digits |
number of digits |
matrix of 1-O for model ages
Andersen, T., Elburg, M., Cawthorn-Blazeby, A., 2015. U-Pb and Lu-Hf zircon data in young sediments reflect sedimentary recycling in eastern South Africa. J. Geol. Soc. London. 2006-2015. doi:10.1144/jgs2015-006
Convenience function to change axes limits for ggplot2
plot_axis_lim(xlim = c(0, 4560), step = 200, ylim = NULL)
plot_axis_lim(xlim = c(0, 4560), step = 200, ylim = NULL)
xlim |
x-axis limit |
step |
specify x-axis steps |
ylim |
y-axis limit |
list of ggplot2::coord_cartesian object
Stripped down theme for ggplot2
plot_bw_theme()
plot_bw_theme()
Returns ggplot2 theme
Creates density for U-Pb data.
plot_dens( dat, bw = 30, type = "kde", age_range = c(0, 4560), facet = FALSE, fixed_y = FALSE, step = 200 )
plot_dens( dat, bw = 30, type = "kde", age_range = c(0, 4560), facet = FALSE, fixed_y = FALSE, step = 200 )
dat |
data.frame |
bw |
density bandwidth |
type |
'kde': traditional KDE 'pdd': detrital zircon PDD |
age_range |
range over which to calculate density |
facet |
logical, facet samples? |
fixed_y |
logical, fixed y-axis? |
step |
specify x-axis steps |
ggplot2 1d density plot with histogram
Creates density and histogram plot of U-Pb data.
plot_dens_hist( dat, bw = 30, binwidth = 50, type = "kde", age_range = c(0, 4560), facet = FALSE, fixed_y = FALSE, step = 200 )
plot_dens_hist( dat, bw = 30, binwidth = 50, type = "kde", age_range = c(0, 4560), facet = FALSE, fixed_y = FALSE, step = 200 )
dat |
data.frame |
bw |
density bandwidth |
binwidth |
histogram binwidth |
type |
'kde': traditional KDE 'pdd': detrital zircon PDD |
age_range |
range over which to calculate density |
facet |
logical, facet samples? |
fixed_y |
logical, fixed y-axis? |
step |
specify x-axis steps |
ggplot2 1d density plot with histogram
Plot ecdf for U-Pb age or Lu-Hf model age data.
plot_ecdf( dat, mult_ecdf = FALSE, column = "age", conf = FALSE, guide = TRUE, alpha = 0.05 )
plot_ecdf( dat, mult_ecdf = FALSE, column = "age", conf = FALSE, guide = TRUE, alpha = 0.05 )
dat |
data.frame |
mult_ecdf |
logical, plot several ecdfs in same plot |
column |
which column to use |
conf |
logical, plot confidence bands |
guide |
logical, show legend |
alpha |
alpha-level used for confidence bands |
Plot Lu-Hf data as both epsilon-Hf vs. age and 176/177Hf vs. age.
plot_hf( dat, range = c(0, 4560), plot_type = "ehf", guide = TRUE, x_errors = FALSE, y_errors = FALSE, error_bars = FALSE, contours = FALSE, x_bandwidth = NULL, y_bandwidth = NULL, contour_data = NULL, combine_contours = FALSE, constants )
plot_hf( dat, range = c(0, 4560), plot_type = "ehf", guide = TRUE, x_errors = FALSE, y_errors = FALSE, error_bars = FALSE, contours = FALSE, x_bandwidth = NULL, y_bandwidth = NULL, contour_data = NULL, combine_contours = FALSE, constants )
dat |
data.frame |
range |
range to display |
plot_type |
'ehf'=epsilon-Hf; 'hfhf'=176/177Hf |
guide |
logical, show legend? |
x_errors |
logical, include x errorbars |
y_errors |
logical, include y errorbars |
error_bars |
logical, include errorbars |
contours |
logical, plot contours? |
x_bandwidth |
bandwidth 2dkde x-direction |
y_bandwidth |
bandwidth 2dkde y-direction |
contour_data |
data.frame containing data to contour |
combine_contours |
logical combine contouring data |
constants |
vector of constants which must be in the order decay constant 176Lu, 176/177Hf CHUR, 176Lu/177Hf CHUR, 176/177Hf DM and 176Lu/177Hf DM |
Convenience function to label ggplot2
plot_labels(xlab = "Age (Ma)", ylab = "Density")
plot_labels(xlab = "Age (Ma)", ylab = "Density")
xlab |
X-axis label |
ylab |
Y-axis label |
Returns ggplot2 labels
Add manual shape scale to scatter plot
plot_point_scale()
plot_point_scale()
Plot quantiles
plot_quantiles( dat, column = "t_dm2", conf = FALSE, alpha = 0.05, type = 8, guide = TRUE, mix = FALSE, mix_data = NULL )
plot_quantiles( dat, column = "t_dm2", conf = FALSE, alpha = 0.05, type = 8, guide = TRUE, mix = FALSE, mix_data = NULL )
dat |
data.frame |
column |
which column in data.frame to use |
conf |
logical, plot confidence interval |
alpha |
alpha-level |
type |
type of quantile calculation (passed on to stats::quantile) |
guide |
logical, show legend? |
mix |
logical, add mixing model |
mix_data |
mixing model data |
Plot likelihood of intercept ages
plot_reimink(dat)
plot_reimink(dat)
dat |
data.frame |
Modify text options of plots
plot_text_options( font_name = "Helvetica", title_size = 10, label_size = 7, legend_size = 10, strip_text_y_size = 8 )
plot_text_options( font_name = "Helvetica", title_size = 10, label_size = 7, legend_size = 10, strip_text_y_size = 8 )
font_name |
Name of font to use |
title_size |
Font size of x- and y-axis titles |
label_size |
Font size of x- and y-axis tick labels |
legend_size |
Font size of legend |
strip_text_y_size |
Font size of vertical panel text |
Tile plot of 1-O matrix
plot_tile(dat, type)
plot_tile(dat, type)
dat |
data.frame |
type |
What to plot |
Populate matrix
populate_matrix(dat, FUN, ...)
populate_matrix(dat, FUN, ...)
dat |
data.frame |
FUN |
Function used to populate matrix |
... |
Additional parameters passed to function |
Populated matrix
Calculate confidence bands for lower and upper quartile
quant_bounds(dat, column = "t_dm2", alpha = 0.05)
quant_bounds(dat, column = "t_dm2", alpha = 0.05)
dat |
data.frame |
column |
column to use for calculations |
alpha |
alpha-level |
Calculate upper and lower concordia intercepts from discordant detrital zircon data
reimink(dat, step = 5)
reimink(dat, step = 5)
dat |
data.frame |
step |
Chord spacing |
Reimink, J.R., Davies, J.H.F.L., Waldron, J.W.F., Rojas, X. (2016). Dealing with discordance: a novel approach for analysing U-Pb detrital zircon datasets. Journal of the Geological Society. doi: 10.1144/jgs2015-114
Launch shiny interface
run_detzrcr(...)
run_detzrcr(...)
... |
Pass arguments on to shiny::runApp |
Calculates the likeness of detrital zircon populations in 1 dimension after Satkoski et al. (2013).
satkoski_1d(x, y, bw = 30, digits = 3)
satkoski_1d(x, y, bw = 30, digits = 3)
x |
vector |
y |
vector |
bw |
bandwidth |
digits |
number, round result to significant digits |
Satkoski, A.M., Wilkinson, B.H., Hietpas, J., Samson, S.D., 2013. Likeness among detrital zircon populations - An approach to the comparison of age frequency data in time and space. GSA Bulletin 125, 1783-1799.
Populate a matrix with pairwise Satkoski 1d likeness.
satkoski_1d_matrix(dat, bw = 30, digits = 3)
satkoski_1d_matrix(dat, bw = 30, digits = 3)
dat |
data.frame |
bw |
density bandwidth |
digits |
number, round result to significant digits |
Satkoski, A.M., Wilkinson, B.H., Hietpas, J., Samson, S.D., 2013. Likeness among detrital zircon populations - An approach to the comparison of age frequency data in time and space. GSA Bulletin 125, 1783-1799.
Calculates the likeness of detrital zircon populations in 2 dimensions after Satoski et al. (2013).
satkoski_2d(x, y, bw = c(30, 2.5), digits = 3)
satkoski_2d(x, y, bw = c(30, 2.5), digits = 3)
x |
vector |
y |
vector |
bw |
vector of density bandwidths |
digits |
number, round result to significant digits |
Satkoski, A.M., Wilkinson, B.H., Hietpas, J., Samson, S.D., 2013. Likeness among detrital zircon populations - An approach to the comparison of age frequency data in time and space. GSA Bulletin 125, 1783-1799.
Populate a matrix with pairwise Satkoski 12 likeness.
satkoski_2d_matrix(dat, bw = c(30, 2.5), digits = 3)
satkoski_2d_matrix(dat, bw = c(30, 2.5), digits = 3)
dat |
data.frame |
bw |
vector of density bandwidths |
digits |
number, round result to significant digits |
Satkoski, A.M., Wilkinson, B.H., Hietpas, J., Samson, S.D., 2013. Likeness among detrital zircon populations - An approach to the comparison of age frequency data in time and space. GSA Bulletin 125, 1783-1799.
Ready 1-O matrix for tile plot
tile_func(x)
tile_func(x)
x |
1-O parameter vector |
Apply tile_func to vector
tiling(z)
tiling(z)
z |
1-O parameter vector |
Atomic ratio of 238U and 235U.
u238_u235_ratio
u238_u235_ratio
An object of class numeric
of length 1.
Steiger, R. & Jager, E. 1977. SUBCOMMISSION ON GEOCHRONOLOGY - CONVENTION ON USE OF DECAY CONSTANTS IN GEOCHRONOLOGY AND COSMOCHRONOLOGY. Earth And Planetary Science Letters 36(3), 359-362.