Package 'detzrcr'

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

Help Index


Calculate slope and intercept

Description

Calculate slope and intercept

Usage

calc_ab(t2, t1)

Arguments

t2

upper intercept

t1

lower intercept


Calculate 1D density of age data

Description

Calculate the 1d density of U-Pb age data using KDE or PDD.

Usage

calc_dens(dat, bw = 30, type = "kde", age_range = c(0, 4560))

Arguments

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

Value

Density


Calculate scaled 1d density

Description

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

Usage

calc_dens_hist(
  dat,
  binwidth = 50,
  bw = 30,
  type = "kde",
  age_range = c(0, 4560)
)

Arguments

dat

data.frame

binwidth

Histogram binwidth

bw

Density bandwidth

type

'kde': KDE; 'pdd': detrital zircon PDD

age_range

Age range to calculated density over

Value

Returns density


Dvoretzky-Kiefer-Wolfowitz inequality

Description

Calculate confidence bands for ecdfs using the Dvoretzky-Kiefer-Wolfowitz inequality.

Usage

calc_dkw(dat, column = "age", alpha = 0.05)

Arguments

dat

data.frame

column

which column to use

alpha

Desired alpha level

Value

data.frame with ecdf and confidence bands

References

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


Calculate hafnium values.

Description

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).

Usage

calc_hf(dat, constants)

Arguments

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

References

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

Description

Calculate 1-O

Usage

calc_o_param(dat1, dat2, column, alpha = 0.05, digits = 2)

Arguments

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

Value

1-O

References

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

Description

Calculate intercepts and associated p-value

Usage

calc_p_apply(dat, t2, t1)

Arguments

dat

data.frame

t2

upper intercept age

t1

lower intercept age


Calculate quantiles

Description

Split up data.frame by sample-column and calculate quantiles

Usage

calc_quantiles(dat, column = "t_dm2", alpha = 0.05, type = 8)

Arguments

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 concordancy of input ages

Description

Check the concordancy of the U-Pb data and return the data within the desired discordancy limit.

Usage

check_conc(dat, disc_lim = 10)

Arguments

dat

data.frame containing at least ages and percentage of discordancy

disc_lim

Discordancy limit

Value

Concordant data


Combine two square matrices

Description

Combine two square matrices

Usage

combine_matrices(mat1, mat2)

Arguments

mat1

Matrix for upper triangle

mat2

Matrix for lower triangle


Calculate U235 at given age

Description

Calculate U235 at given age

Usage

concX(age)

Arguments

age

input age


Calculate U238 at given age

Description

Calculate U238 at given age

Usage

concY(age)

Arguments

age

input age


Calculate mixing model

Description

Gaussian mixing model for detrital zircon data, using lower quantile upper quantile plot

Usage

dzr_mix(mu1, sig1, mu2, sig2)

Arguments

mu1

first mean

sig1

first standard deviation

mu2

second mean

sig2

second standard deviation

Examples

dzr_mix(500, 50, 1000, 100)

Find maxima.

Description

Find maxima.

Usage

find_maxima(dist, xmin, inc)

Arguments

dist

distribution.

xmin

minimum value of distribution.

inc

increment.


Find maximum value for plotting.

Description

Find the maximum value for histogram plotting.

Usage

find_plot_max(x, accuracy = 100)

Arguments

x

vector of values

accuracy

round to nearest


Find minimum value for plotting

Description

Find the minimum value for histogram plotting.

Usage

find_plot_min(x, accuracy = 100)

Arguments

x

vector of values

accuracy

round to nearest


Wrapper function for find_plot_min and find_plot_max

Description

Find the minimum and maximum values for histogram plotting.

Usage

find_plot_min_max(x, accuracy = 100)

Arguments

x

Age data

accuracy

Round to nearest

Value

Returns vector of minimum and maximum plotting values


Produce CHUR and DM lines

Description

Calculate CHUR and DM lines used for epsilon-Hf vs. age and 176/177Hf vs. age plots.

Usage

hf_lines(range = c(0, 4560), plot_type = "ehf", constants)

Arguments

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

References

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.

Description

176Hf/177Hf value of CHUR.

Usage

hfhf_chur

Format

An object of class numeric of length 1.

References

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.

Description

176Lu/177Hf value of DM.

Usage

hfhf_dm

Format

An object of class numeric of length 1.

References

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.

Description

Decay constant of 176Lu.

Usage

lambda_lu

Format

An object of class numeric of length 1.

References

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.

Description

Decay constants of 235U.

Usage

lambda_u235

Format

An object of class numeric of length 1.

References

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.

Description

Decay constants of 238U.

Usage

lambda_u238

Format

An object of class numeric of length 1.

References

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.

Description

176Lu/177Hf value of CHUR.

Usage

luhf_chur

Format

An object of class numeric of length 1.

References

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.

Description

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).

Usage

luhf_dm

Format

An object of class numeric of length 1.

References

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.

Description

176Lu/177Hf value of average continental crust.

Usage

luhf_zrc

Format

An object of class numeric of length 1.

References

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

Description

Produce data.frame of 1-O matrix suitable for geom_tile

Usage

make_tiling(dat, type)

Arguments

dat

data.frame

type

What to calculate


Dataset Natal group

Description

Detrital zircon U-Pb age and Lu-Hf data from the Natal Group, KwaZulu-Natal, South-Africa (Kristoffersen et al. 2016).

Details

Used as example of proper format of a csv-file for input in the shiny interface.

References

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

Description

Populate matrix with age 1-O

Usage

o_param_matrix_age(dat, alpha = 0.05, digits = 2)

Arguments

dat

data.frame

alpha

alpha level

digits

number of digits

Value

matrix of 1-O for ages

References

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

Description

Populate matrix with model age 1-O

Usage

o_param_matrix_tdm(dat, alpha = 0.05, digits = 2)

Arguments

dat

data.frame

alpha

alpha level

digits

number of digits

Value

matrix of 1-O for model ages

References

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


Axes limits for ggplot2

Description

Convenience function to change axes limits for ggplot2

Usage

plot_axis_lim(xlim = c(0, 4560), step = 200, ylim = NULL)

Arguments

xlim

x-axis limit

step

specify x-axis steps

ylim

y-axis limit

Value

list of ggplot2::coord_cartesian object


Stripped down theme for ggplot2

Description

Stripped down theme for ggplot2

Usage

plot_bw_theme()

Value

Returns ggplot2 theme


Plot 1d density

Description

Creates density for U-Pb data.

Usage

plot_dens(
  dat,
  bw = 30,
  type = "kde",
  age_range = c(0, 4560),
  facet = FALSE,
  fixed_y = FALSE,
  step = 200
)

Arguments

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

Value

ggplot2 1d density plot with histogram


Plot 1d density with histogram

Description

Creates density and histogram plot of U-Pb data.

Usage

plot_dens_hist(
  dat,
  bw = 30,
  binwidth = 50,
  type = "kde",
  age_range = c(0, 4560),
  facet = FALSE,
  fixed_y = FALSE,
  step = 200
)

Arguments

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

Value

ggplot2 1d density plot with histogram


Plot ecdf

Description

Plot ecdf for U-Pb age or Lu-Hf model age data.

Usage

plot_ecdf(
  dat,
  mult_ecdf = FALSE,
  column = "age",
  conf = FALSE,
  guide = TRUE,
  alpha = 0.05
)

Arguments

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

Description

Plot Lu-Hf data as both epsilon-Hf vs. age and 176/177Hf vs. age.

Usage

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
)

Arguments

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


Labels for ggplot2 plots

Description

Convenience function to label ggplot2

Usage

plot_labels(xlab = "Age (Ma)", ylab = "Density")

Arguments

xlab

X-axis label

ylab

Y-axis label

Value

Returns ggplot2 labels


Add manual shape scale to scatter plot

Description

Add manual shape scale to scatter plot

Usage

plot_point_scale()

Plot quantiles

Description

Plot quantiles

Usage

plot_quantiles(
  dat,
  column = "t_dm2",
  conf = FALSE,
  alpha = 0.05,
  type = 8,
  guide = TRUE,
  mix = FALSE,
  mix_data = NULL
)

Arguments

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

Description

Plot likelihood of intercept ages

Usage

plot_reimink(dat)

Arguments

dat

data.frame


Modify text options of plots

Description

Modify text options of plots

Usage

plot_text_options(
  font_name = "Helvetica",
  title_size = 10,
  label_size = 7,
  legend_size = 10,
  strip_text_y_size = 8
)

Arguments

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

Description

Tile plot of 1-O matrix

Usage

plot_tile(dat, type)

Arguments

dat

data.frame

type

What to plot


Populate matrix

Description

Populate matrix

Usage

populate_matrix(dat, FUN, ...)

Arguments

dat

data.frame

FUN

Function used to populate matrix

...

Additional parameters passed to function

Value

Populated matrix


Calculate confidence bands for lower and upper quartile

Description

Calculate confidence bands for lower and upper quartile

Usage

quant_bounds(dat, column = "t_dm2", alpha = 0.05)

Arguments

dat

data.frame

column

column to use for calculations

alpha

alpha-level


Calculate upper and lower concordia intercepts from discordant detrital zircon data

Description

Calculate upper and lower concordia intercepts from discordant detrital zircon data

Usage

reimink(dat, step = 5)

Arguments

dat

data.frame

step

Chord spacing

References

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

Description

Launch shiny interface

Usage

run_detzrcr(...)

Arguments

...

Pass arguments on to shiny::runApp


Calculate 1d likeness of detrital zircon populations

Description

Calculates the likeness of detrital zircon populations in 1 dimension after Satkoski et al. (2013).

Usage

satkoski_1d(x, y, bw = 30, digits = 3)

Arguments

x

vector

y

vector

bw

bandwidth

digits

number, round result to significant digits

References

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.


Pairwise Satkoski likeness

Description

Populate a matrix with pairwise Satkoski 1d likeness.

Usage

satkoski_1d_matrix(dat, bw = 30, digits = 3)

Arguments

dat

data.frame

bw

density bandwidth

digits

number, round result to significant digits

References

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.


Calculate 2d (age and Lu-Hf) likeness of detrital zircon populations

Description

Calculates the likeness of detrital zircon populations in 2 dimensions after Satoski et al. (2013).

Usage

satkoski_2d(x, y, bw = c(30, 2.5), digits = 3)

Arguments

x

vector

y

vector

bw

vector of density bandwidths

digits

number, round result to significant digits

References

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.


Pairwise 2d Satkoski likeness

Description

Populate a matrix with pairwise Satkoski 12 likeness.

Usage

satkoski_2d_matrix(dat, bw = c(30, 2.5), digits = 3)

Arguments

dat

data.frame

bw

vector of density bandwidths

digits

number, round result to significant digits

References

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

Description

Ready 1-O matrix for tile plot

Usage

tile_func(x)

Arguments

x

1-O parameter vector


Apply tile_func to vector

Description

Apply tile_func to vector

Usage

tiling(z)

Arguments

z

1-O parameter vector


Atomic ratio of 238U and 235U.

Description

Atomic ratio of 238U and 235U.

Usage

u238_u235_ratio

Format

An object of class numeric of length 1.

References

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.