### Install IsoplotR Development Version from GitHub Source: https://github.com/pvermees/isoplotr/blob/master/README.md Install the current development version of IsoplotR from Github using the remotes package. Ensure you have the remotes package installed first. ```r install.packages('remotes') remotes::install_github('pvermees/IsoplotR') ``` -------------------------------- ### Install IsoplotR Package Source: https://context7.com/pvermees/isoplotr/llms.txt Installs the stable version from CRAN or the development version from GitHub. Loads the library for use. ```r install.packages('IsoplotR') install.packages('remotes') remotes::install_github('pvermees/IsoplotR') library(IsoplotR) ``` -------------------------------- ### Load IsoplotR Library Source: https://github.com/pvermees/isoplotr/blob/master/README.md Load the IsoplotR package into your R session after installation to start using its functions. ```r library(IsoplotR) ``` -------------------------------- ### Install IsoplotR from CRAN Source: https://github.com/pvermees/isoplotr/blob/master/README.md Use this command to install the most recent stable version of IsoplotR from CRAN. ```r install.packages('IsoplotR') ``` -------------------------------- ### Get and Set Decay Constants and Isotopic Parameters Source: https://context7.com/pvermees/isoplotr/llms.txt Retrieve or override decay constants, isotopic ratios, and other parameters used in calculations. Supports JSON import/export. ```r # Read current U-238 decay constant [value, 1-sigma error] settings('lambda', 'U238') # Override with a custom value settings('lambda', 'U238', 1.55125e-10, 0.17e-12) # Read the 238U/235U isotopic ratio settings('iratio', 'U238U235') # Set the significance level for confidence intervals settings('alpha', 0.05) ``` -------------------------------- ### Perform Kernel Density Estimation (KDE) Source: https://context7.com/pvermees/isoplotr/llms.txt Generate adaptive kernel density estimates for age distributions, optionally overlaid with a histogram. Supports log transformation and multiple samples. Requires attaching example data. ```r attach(examples) kde(DZ, show.hist = TRUE, binwidth = 50) kde(ArAr, log = TRUE) Ages <- c(250, 260, 255, 480, 485, 1000, 1010) kde(ages, from = 100, to = 1200) kde(DZ, ncol = 2, nmodes = 3, sigdig = 3) k <- kde(DZ, plot = FALSE) str(k) # list: x (ages), y (density), bw (bandwidth) ``` -------------------------------- ### Read Data and Plot Isochron Source: https://github.com/pvermees/isoplotr/blob/master/README.md Example of navigating to built-in data files, reading a CSV file using the 'Rb-Sr' method with format 1, and generating an isochron plot. ```r setwd(system.file(package='IsoplotR')) # navigate to the built-in data files RbSr <- read.data('RbSr1.csv',method='Rb-Sr',format=1) isochron(RbSr) ``` -------------------------------- ### Generate U-Th-He Ternary / Logratio Plots Source: https://context7.com/pvermees/isoplotr/llms.txt Visualize U-Th(-Sm)-He data on a logratio plot or ternary diagram and compute a compositional central age. Requires attaching example data. ```r attach(examples) helioplot(UThHe, logratio = TRUE) helioplot(UThHe, logratio = FALSE) helioplot(UThHe, model = 3) helioplot(UThHe, levels = 1:nrow(UThHe$x)) ``` -------------------------------- ### Perform Multidimensional Scaling (MDS) on Detrital Age Distributions Source: https://context7.com/pvermees/isoplotr/llms.txt Reduce pairwise distances between detrital age samples into a 2D configuration for visual comparison. Supports classical and nonmetric MDS, and different distance metrics. Requires attaching example data. ```r attach(examples) mds(DZ, classical = TRUE) mds(DZ, classical = FALSE, nnlines = TRUE) mds(DZ, shepard = TRUE) mds(DZ, method = 'W2') ``` -------------------------------- ### Create Cumulative Age Distribution (CAD) plots Source: https://context7.com/pvermees/isoplotr/llms.txt Plot empirical cumulative distribution functions for one or more age datasets for direct visual comparison without smoothing. Requires attaching example data. ```r attach(examples) cad(ArAr) cad(DZ, col = 'rainbow') cad(DZ[1:2], verticals = TRUE, col = c('blue', 'red')) ``` -------------------------------- ### Generate Galbraith radial plots Source: https://context7.com/pvermees/isoplotr/llms.txt Visualize ages with different precisions on a Galbraith radial plot. Optionally overlay finite or continuous mixture models. Requires attaching example data. ```r attach(examples) radialplot(FT1) radialplot(ArAr, transformation = 'log') radialplot(UPb, type = 2, show.numbers = TRUE) radialplot(FT1, k = 2) radialplot(FT1, z0 = 100, from = 50, to = 300) ``` -------------------------------- ### Calculate Central Age for Overdispersed Data Source: https://context7.com/pvermees/isoplotr/llms.txt Fit a random effects model to fission track or U-Th-He data to decompose scatter into analytical uncertainty and geological dispersion. Requires attaching example data. ```r attach(examples) central(FT1) # Returns: t (central age), s[t], disp (overdispersion), MSWD, p.value central(UThHe) age(FT1, central = TRUE) age(UThHe, central = TRUE) ``` -------------------------------- ### Calculate Weighted Mean Age with Outlier Detection Source: https://context7.com/pvermees/isoplotr/llms.txt Compute a weighted mean from heteroscedastic ages using inverse-variance or random effects models. Applies modified Chauvenet criterion for outlier rejection. Requires attaching example data. ```r attach(examples) weightedmean(ArAr, random.effects = TRUE) weightedmean(UPb, type = 2, detect.outliers = TRUE) mat <- cbind(c(100, 102, 99, 150), # ages c(2, 3, 2, 5)) # 1-sigma errors weightedmean(mat, random.effects = FALSE) ``` -------------------------------- ### settings() Source: https://context7.com/pvermees/isoplotr/llms.txt Allows saving and restoring decay constants and isotopic ratios as JSON for reproducible workflows. ```APIDOC ## settings() ### Description Saves or loads the current settings (e.g., decay constants, isotopic ratios) to or from a JSON file. ### Parameters #### Path Parameters - **fname** (string) - Required - The file path for the JSON file to save or load settings from. ### Request Example ```r # Export all settings to a JSON file settings(fname = '/tmp/mySettings.json') # Import settings from a JSON file settings(fname = '/tmp/mySettings.json') ``` ``` -------------------------------- ### settings() Source: https://context7.com/pvermees/isoplotr/llms.txt Retrieves or sets decay constants, isotopic ratios, and other parameters used in geochronological calculations. ```APIDOC ## settings() ### Description Retrieves or overrides the decay constants, isotopic ratios, molar masses, and fission track parameters used internally by all calculations. Supports import/export via JSON. ### Usage settings(parameter, isotope, value = NULL, error = NULL) ### Parameters - `parameter`: The parameter to get or set (e.g., 'lambda', 'iratio', 'alpha'). - `isotope`: The specific isotope or parameter name (e.g., 'U238', 'U238U235'). - `value`: The new value to set (optional). - `error`: The error associated with the new value (optional). ### Examples ```r # Read current U-238 decay constant [value, 1-sigma error] settings('lambda', 'U238') # Override with a custom value settings('lambda', 'U238', 1.55125e-10, 0.17e-12) # Read the 238U/235U isotopic ratio settings('iratio', 'U238U235') # Set the significance level for confidence intervals settings('alpha', 0.05) ``` ``` -------------------------------- ### kde() Source: https://context7.com/pvermees/isoplotr/llms.txt Performs adaptive kernel density estimation for age distributions, with options for overlaying histograms and customizing plot appearance. ```APIDOC ## kde() ### Description Generates adaptive kernel density estimates (Botev 2010 bandwidth + Abramson 1982 adaptive modifier) for age distributions, optionally overlaid with a histogram. ### Usage kde(data, show.hist = FALSE, binwidth = NULL, log = FALSE, from = NULL, to = NULL, ncol = 1, nmodes = NULL, sigdig = NULL, plot = TRUE) ### Parameters - `data`: The input age data (e.g., DZ, ArAr) or a numeric vector of ages. - `show.hist`: Logical, whether to show a histogram overlay. - `binwidth`: The binwidth for the histogram. - `log`: Logical, whether to perform estimation on a log scale. - `from`, `to`: Range for the density estimation. - `ncol`: Number of columns for multiple sample plots. - `nmodes`: Number of modes to highlight. - `sigdig`: Number of significant digits for labels. - `plot`: Logical, whether to generate a plot. ### Examples ```r attach(examples) # KDE of detrital zircon ages with histogram kde(DZ, show.hist = TRUE, binwidth = 50) # Ar-Ar KDE on log scale kde(ArAr, log = TRUE) # KDE from a numeric vector ages <- c(250, 260, 255, 480, 485, 1000, 1010) kde(ages, from = 100, to = 1200) # Multiple samples in one panel; label top-3 modes kde(DZ, ncol = 2, nmodes = 3, sigdig = 3) # Capture KDE object without plotting k <- kde(DZ, plot = FALSE) str(k) # list: x (ages), y (density), bw (bandwidth) ``` ``` -------------------------------- ### Export and Import Settings with JSON Source: https://context7.com/pvermees/isoplotr/llms.txt Use the settings() function to export current geochronometer settings to a JSON file or import them from a JSON file. This is useful for reproducible workflows. ```r settings(fname = '/tmp/mySettings.json') ``` ```r settings(fname = '/tmp/mySettings.json') ``` -------------------------------- ### age() Source: https://context7.com/pvermees/isoplotr/llms.txt Calculates isotopic ages and propagates uncertainties for various geochronometers. It dispatches methods based on the input data class and supports different age calculation types. ```APIDOC ## `age()` — Calculate isotopic ages and propagate uncertainties A generic S3 function dispatching on the class of the input object. Returns individual grain ages (type 1), concordia ages (type 2), discordia ages (type 3–5), isochron ages, or central ages, with configurable uncertainty output. ### Usage ```r age(x, ...) ``` ### Parameters * **x**: An object of a typed IsoplotR data class (e.g., `UPb`, `ArAr`) or a numeric vector for single ratio ages. * **type** (integer, optional): Specifies the type of age to calculate (e.g., 1 for individual grain ages, 2 for concordia ages, 3-5 for discordia ages). * **oerr** (integer, optional): Sets the type of output errors (e.g., 1 for 1-sigma, 2 for 2-sigma absolute errors). * **isochron** (boolean, optional): If TRUE, calculates an isochron age. * **i2i** (boolean, optional): If TRUE, derives the initial `40Ar/36Ar` ratio from the isochron intercept. * **central** (boolean, optional): If TRUE, calculates a central age. * **method** (string, optional): Specifies the geochronometer method when calculating age from a single ratio. ### Request Example ```r attach(examples) # U-Pb: individual grain ages (t.75, t.68, t.76, t.conc, disc) tUPb <- age(UPb, type = 1, oerr = 2) # 2-sigma absolute errors head(tUPb) # U-Pb concordia age from all grains tconc <- age(UPb, type = 2) print(tconc$age) # [age, s[age]] # U-Pb discordia (Ludwig maximum likelihood) tdisc <- age(UPb, type = 3) # Ar-Ar individual ages tArAr <- age(ArAr, oerr = 1) # Ar-Ar isochron age (i2i = initial 40Ar/36Ar from isochron intercept) tiso <- age(ArAr, isochron = TRUE, i2i = TRUE) # Fission track central age tft <- age(FT1, central = TRUE) # Single scalar ratio -> age (no object needed) age(c(0.511, 0.001), method = 'U238-Pb206') # returns [t68, s[t68]] # U-Th-He age from raw measurements age(c(238, 2, 232, 3, 4e-9, 1e-11), method = 'U-Th-He') ``` ``` -------------------------------- ### age2ratio() Source: https://context7.com/pvermees/isoplotr/llms.txt Converts ages (with uncertainties) into isotopic ratios for supported geochronometers, including error propagation. ```APIDOC ## age2ratio() ### Description Predicts isotopic ratios from ages (with uncertainties) for any supported geochronometer, performing full error propagation. ### Parameters #### Path Parameters - **tt** (numeric or numeric vector) - Required - The age(s) in Ma. - **st** (numeric) - Optional - The uncertainty in the age(s) in Ma. If not provided, no error propagation is performed. - **ratio** (string) - Required - The isotopic ratio to calculate. Supported values include 'Pb206U238', 'Wetherill', 'Tera-Wasserburg', 'Ar40Ar39', 'Stacey-Kramers'. - **J** (numeric) - Optional - The J-factor, required for 'Ar40Ar39' ratio. - **sJ** (numeric) - Optional - The uncertainty in the J-factor, required for 'Ar40Ar39' ratio when uncertainty is needed. ### Request Example ```r # Predict Pb206/U238 ratio at 500 Ma (±5 Ma) age2ratio(tt = 500, st = 5, ratio = 'Pb206U238') # Wetherill concordia coordinates at 1000 Ma age2ratio(tt = 1000, st = 10, ratio = 'Wetherill') # Returns list: $x (Pb207U235, Pb206U238), $cov (2x2 covariance) # Tera-Wasserburg coordinates age2ratio(tt = 1000, st = 10, ratio = 'Tera-Wasserburg') # Ar-Ar ratio requiring a J-factor age2ratio(tt = 65, st = 1, ratio = 'Ar40Ar39', J = 0.01, sJ = 0.0001) # Stacey-Kramers Pb isotope evolution model age2ratio(tt = c(500, 1000, 2000), ratio = 'Stacey-Kramers') ``` ### Response #### Success Response (200) - **x** (numeric or list) - The calculated isotopic ratio(s) or coordinates. - **cov** (matrix) - The covariance matrix of the calculated ratios, if uncertainties are provided. ``` -------------------------------- ### read.data() Source: https://context7.com/pvermees/isoplotr/llms.txt Loads geochronological data from CSV files or R matrices into typed S3 classes for various geochronometers. It supports multiple data formats for each method. ```APIDOC ## `read.data()` — Load geochronological data from CSV or matrix Parses a `.csv` file (or an R matrix) and casts it into one of IsoplotR's typed data classes. The `method` argument selects the geochronometer and `format` specifies the column layout (up to 12 formats for U-Pb alone). ### Usage ```r read.data(file, method, format, ...) ``` ### Parameters * **file**: Path to the CSV file or an R matrix containing the data. * **method** (string): The geochronometer to use (e.g., 'U-Pb', 'Rb-Sr', 'Ar-Ar', 'fissiontracks', 'detritals'). * **format** (integer, optional): Specifies the column layout of the input data. Defaults to 1 if not provided. ### Request Example ```r library(IsoplotR) UPb <- read.data('UPb1.csv', method = 'U-Pb', format = 1) RbSr <- read.data('RbSr1.csv', method = 'Rb-Sr', format = 1) ArAr <- read.data('ArAr1.csv', method = 'Ar-Ar', format = 1) FT <- read.data('FT1.csv', method = 'fissiontracks', format = 1) DZ <- read.data('DZ.csv', method = 'detritals') mat <- matrix(c(0.0753, 0.0002, 0.0511, 0.0003, 0.9), ncol = 5, dimnames = list(NULL, c('Pb207U235','errPb207U235', 'Pb206U238','errPb206U238','rXY'))) UPb_mat <- read.data(mat, method = 'U-Pb', format = 1) ``` ``` -------------------------------- ### isochron() Source: https://context7.com/pvermees/isoplotr/llms.txt Fits isochrons to multi-aliquot data using various regression algorithms and computes isochron ages. It supports different regression models and handling of overdispersion. ```APIDOC ## `isochron()` — Fit isochrons and compute isochron ages Fits regression lines through cogenetic multi-aliquot data using York (2004), Titterington, or Ludwig algorithms. Handles overdispersion via MSWD-inflation, total least squares, or geological scatter models. ### Usage ```r isochron(x, ...) ``` ### Parameters * **x**: An object of a typed IsoplotR data class (e.g., `RbSr`, `ArAr`) containing multi-aliquot data. * **i2i** (boolean, optional): If TRUE, derives the initial `40Ar/36Ar` ratio from the isochron intercept. * **inverse** (boolean, optional): If TRUE, fits an inverse isochron. ### Request Example ```r attach(examples) # Rb-Sr isochron isochron(RbSr) # Returns: age, s[age], initial 87Sr/86Sr, MSWD, p-value # Ar-Ar inverse isochron (i2i = derive initial 40Ar/36Ar from intercept) isochron(ArAr, i2i = TRUE, inverse = TRUE) ``` ``` -------------------------------- ### Plot U-Pb Concordia Diagrams with concordia() Source: https://context7.com/pvermees/isoplotr/llms.txt Plots U-Pb data on Wetherill or Tera-Wasserburg concordia diagrams, fits discordia lines, and computes concordia ages and MSWD. Ellipses can be colored by specific data levels. ```r attach(examples) # Wetherill concordia with error ellipses (default) concordia(UPb, type = 1, show.ellipses = 1) # Tera-Wasserburg concordia with discordia line concordia(UPb, type = 2, exterr = TRUE) # Colour ellipses by U concentration levels concordia(UPb, type = 1, levels = UPb$x[, 'Pb207U235'], clabel = '207Pb/235U', ellipse.fill = c('white', 'red')) # Suppress plot, just get concordia age ca <- concordia_age(UPb, i = 1, exterr = FALSE) print(ca$age) # [t.conc, s[t.conc], MSWD, p-value] ``` -------------------------------- ### Predict Isotopic Ratios from Ages with age2ratio() Source: https://context7.com/pvermees/isoplotr/llms.txt Converts ages (with uncertainties) to isotopic ratios for supported geochronometers, including error propagation. Specify the age (tt), its uncertainty (st), and the desired ratio. ```r # Predict Pb206/U238 ratio at 500 Ma (±5 Ma) age2ratio(tt = 500, st = 5, ratio = 'Pb206U238') ``` ```r # Wetherill concordia coordinates at 1000 Ma age2ratio(tt = 1000, st = 10, ratio = 'Wetherill') # Returns list: $x (Pb207U235, Pb206U238), $cov (2x2 covariance) ``` ```r # Tera-Wasserburg coordinates age2ratio(tt = 1000, st = 10, ratio = 'Tera-Wasserburg') ``` ```r # Ar-Ar ratio requiring a J-factor age2ratio(tt = 65, st = 1, ratio = 'Ar40Ar39', J = 0.01, sJ = 0.0001) ``` ```r # Stacey-Kramers Pb isotope evolution model age2ratio(tt = c(500, 1000, 2000), ratio = 'Stacey-Kramers') ``` -------------------------------- ### Calculate Isotopic Ages with age() Source: https://context7.com/pvermees/isoplotr/llms.txt Calculates various isotopic ages (grain, concordia, discordia, isochron, central) and propagates uncertainties. Can also calculate age from a single ratio. ```r attach(examples) # U-Pb: individual grain ages (t.75, t.68, t.76, t.conc, disc) tUPb <- age(UPb, type = 1, oerr = 2) # 2-sigma absolute errors head(tUPb) # U-Pb concordia age from all grains tconc <- age(UPb, type = 2) print(tconc$age) # [age, s[age]] # U-Pb discordia (Ludwig maximum likelihood) tdisc <- age(UPb, type = 3) # Ar-Ar individual ages tArAr <- age(ArAr, oerr = 1) # Ar-Ar isochron age (i2i = initial 40Ar/36Ar from isochron intercept) tiso <- age(ArAr, isochron = TRUE, i2i = TRUE) # Fission track central age tft <- age(FT1, central = TRUE) # Single scalar ratio -> age (no object needed) age(c(0.511, 0.001), method = 'U238-Pb206') # returns [t68, s[t68]] # U-Th-He age from raw measurements age(c(238, 2, 232, 3, 4e-9, 1e-11), method = 'U-Th-He') ``` -------------------------------- ### cad() Source: https://context7.com/pvermees/isoplotr/llms.txt Plots empirical cumulative distribution functions (step functions) for age datasets, allowing direct visual comparison. ```APIDOC ## cad() ### Description Plots empirical cumulative distribution functions (step functions) for one or more age datasets, enabling direct visual comparison without smoothing. ### Usage cad(data, col = NULL, verticals = FALSE) ### Parameters - `data`: The input age data (e.g., ArAr, DZ). - `col`: Color(s) for the plot lines. - `verticals`: Logical, whether to draw vertical lines at steps. ### Examples ```r attach(examples) # Single-sample CAD cad(ArAr) # Multi-sample detrital CAD with colour ramp cad(DZ, col = 'rainbow') # Compare two samples on the same plot cad(DZ[1:2], verticals = TRUE, col = c('blue', 'red')) ``` ``` -------------------------------- ### Fit isochrons and capture results Source: https://context7.com/pvermees/isoplotr/llms.txt Fit isochrons for various isotopic systems. Suppress plotting to capture results for further analysis. ```r isochron(ReOs, model = 3) isochron(UPb) fit <- isochron(RbSr, plot = FALSE) cat('Rb-Sr isochron age:', fit$age[1], '±', fit$age[2], 'Ma\n') cat('MSWD:', fit$mswd, '\n') ``` -------------------------------- ### concordia() Source: https://context7.com/pvermees/isoplotr/llms.txt Plots U-Pb concordia diagrams (Wetherill or Tera-Wasserburg) with error ellipses and discordia lines. It can also compute concordia ages and MSWD. ```APIDOC ## `concordia()` — Plot U-Pb concordia diagrams Plots U-Pb data on Wetherill or Tera-Wasserburg concordia diagrams with error ellipses, fits discordia lines, and computes concordia ages and MSWD. ### Usage ```r concordia(x, type, ...) ``` ### Parameters * **x**: A `UPb` object containing U-Pb data. * **type** (integer): The type of concordia diagram to plot: 1 for Wetherill, 2 for Tera-Wasserburg. * **show.ellipses** (boolean, optional): If TRUE, displays error ellipses for each data point. * **exterr** (boolean, optional): If TRUE, includes external uncertainties in discordia line fitting. * **levels** (numeric vector, optional): Values to color ellipses by, e.g., `Pb207U235`. * **clabel** (string, optional): Label for the color scale legend. * **ellipse.fill** (vector of strings, optional): Colors to fill the ellipses. ### Request Example ```r attach(examples) # Wetherill concordia with error ellipses (default) concordia(UPb, type = 1, show.ellipses = 1) # Tera-Wasserburg concordia with discordia line concordia(UPb, type = 2, exterr = TRUE) # Colour ellipses by U concentration levels concordia(UPb, type = 1, levels = UPb$x[, 'Pb207U235'], clabel = '207Pb/235U', ellipse.fill = c('white', 'red')) # Suppress plot, just get concordia age ca <- concordia_age(UPb, i = 1, exterr = FALSE) print(ca$age) # [t.conc, s[t.conc], MSWD, p-value] ``` ``` -------------------------------- ### central() Source: https://context7.com/pvermees/isoplotr/llms.txt Fits a random effects model to fission track or U-Th-He data to yield a central age and overdispersion parameter. ```APIDOC ## central() ### Description Fits a random effects model to fission track or U-Th-He data, decomposing scatter into analytical uncertainty and true geological dispersion to yield a central age and overdispersion parameter. ### Usage central(data, model = 1, central = TRUE) ### Parameters - `data`: The input age data (e.g., FT1, UThHe). - `model`: The model to use for fitting. - `central`: Logical, whether to compute the central age. ### Returns - `t`: Central age. - `s[t]`: Standard deviation of the central age. - `disp`: Overdispersion parameter. - `MSWD`: Mean of the squared weighted deviations. - `p.value`: P-value for the MSWD test. ### Examples ```r attach(examples) # Central age of fission track data central(FT1) # Returns: t (central age), s[t], disp (overdispersion), MSWD, p.value # Central U-Th-He age using logratio (compositional) approach central(UThHe) # Via age() wrapper age(FT1, central = TRUE) age(UThHe, central = TRUE) ``` ``` -------------------------------- ### helioplot() Source: https://context7.com/pvermees/isoplotr/llms.txt Visualizes U-Th-He data on a logratio plot or ternary diagram and computes a compositional central age. ```APIDOC ## helioplot() ### Description Visualises U-Th(-Sm)-He data on a logratio plot (`log[He/Th]` vs `log[U/He]`) or a ternary diagram, and computes a compositional (barycentric) central age. ### Usage helioplot(data, logratio = TRUE, model = 1, levels = NULL, plot = TRUE) ### Parameters - `data`: The input U-Th-He data. - `logratio`: Logical, whether to use a logratio plot (TRUE) or ternary diagram (FALSE). - `model`: The model to use for fitting. - `levels`: Optional values for colouring points by grain index. - `plot`: Logical, whether to generate a plot. ### Examples ```r attach(examples) # Logratio plot (default) helioplot(UThHe, logratio = TRUE) # Ternary diagram helioplot(UThHe, logratio = FALSE) # Model 3: add geological overdispersion term helioplot(UThHe, model = 3) # Colour points by grain index helioplot(UThHe, levels = 1:nrow(UThHe$x)) ``` ``` -------------------------------- ### mds() Source: https://context7.com/pvermees/isoplotr/llms.txt Performs multidimensional scaling on detrital age distributions to reduce pairwise distances into a 2D configuration for visual comparison. ```APIDOC ## mds() ### Description Reduces a matrix of Kolmogorov-Smirnov (or Wasserstein-2) pairwise distances between detrital age samples into a 2D configuration for visual comparison. ### Usage mds(data, classical = TRUE, nnlines = FALSE, shepard = FALSE, method = 'KS') ### Parameters - `data`: The detrital age data (e.g., DZ). - `classical`: Logical, whether to use classical MDS. - `nnlines`: Logical, whether to draw nearest-neighbour lines. - `shepard`: Logical, whether to generate a Shepard plot. - `method`: The distance metric to use ('KS' for Kolmogorov-Smirnov, 'W2' for Wasserstein-2). ### Examples ```r attach(examples) # Classical MDS of detrital zircon samples mds(DZ, classical = TRUE) # Nonmetric MDS with nearest-neighbour lines mds(DZ, classical = FALSE, nnlines = TRUE) # Shepard plot to assess goodness of fit mds(DZ, shepard = TRUE) # Wasserstein-2 distance instead of KS mds(DZ, method = 'W2') ``` ``` -------------------------------- ### weightedmean() Source: https://context7.com/pvermees/isoplotr/llms.txt Computes a weighted mean from heteroscedastic ages, with options for outlier detection and different weighting models. ```APIDOC ## weightedmean() ### Description Computes a weighted mean from heteroscedastic ages using either ordinary inverse-variance weights or a random effects (lognormal overdispersion) model. Applies a modified Chauvenet criterion for outlier rejection. ### Usage weightedmean(data, random.effects = TRUE, type = 1, detect.outliers = FALSE) ### Parameters - `data`: The input age data (e.g., ArAr, UPb) or a two-column matrix [value, 1-sigma error]. - `random.effects`: Logical, whether to use a random effects model for overdispersion. - `type`: Data type indicator (e.g., 2 for U-Pb). - `detect.outliers`: Logical, whether to apply outlier detection. ### Examples ```r attach(examples) # Weighted mean of Ar-Ar ages; random effects overdispersion model weightedmean(ArAr, random.effects = TRUE) # U-Pb weighted mean (206Pb/238U ages), reject outliers weightedmean(UPb, type = 2, detect.outliers = TRUE) # From a two-column matrix [value, 1-sigma error] mat <- cbind(c(100, 102, 99, 150), # ages c(2, 3, 2, 5)) # 1-sigma errors weightedmean(mat, random.effects = FALSE) ``` ``` -------------------------------- ### Fit Isochrons with isochron() Source: https://context7.com/pvermees/isoplotr/llms.txt Fits regression lines to cogenetic multi-aliquot data using various algorithms. Handles overdispersion and different regression models. ```r attach(examples) # Rb-Sr isochron isochron(RbSr) # Returns: age, s[age], initial 87Sr/86Sr, MSWD, p-value # Ar-Ar inverse isochron (i2i = derive initial 40Ar/36Ar from intercept) isochron(ArAr, i2i = TRUE, inverse = TRUE) ``` -------------------------------- ### Load Geochronological Data with read.data() Source: https://context7.com/pvermees/isoplotr/llms.txt Reads geochronological data from CSV files or R matrices. Specifies the geochronometer and data format. ```r library(IsoplotR) setwd(system.file(package = 'IsoplotR')) # navigate to built-in example files # U-Pb data, Wetherill format (07/35, err, 06/38, err, rho) UPb <- read.data('UPb1.csv', method = 'U-Pb', format = 1) # Rb-Sr isochron data RbSr <- read.data('RbSr1.csv', method = 'Rb-Sr', format = 1) # Ar-Ar step-heating data ArAr <- read.data('ArAr1.csv', method = 'Ar-Ar', format = 1) # Fission track data (external detector method) FT <- read.data('FT1.csv', method = 'fissiontracks', format = 1) # Detrital zircon multi-sample dataset DZ <- read.data('DZ.csv', method = 'detritals') # From a matrix instead of a file mat <- matrix(c(0.0753, 0.0002, 0.0511, 0.0003, 0.9), ncol = 5, dimnames = list(NULL, c('Pb207U235','errPb207U235', 'Pb206U238','errPb206U238','rXY'))) UPb_mat <- read.data(mat, method = 'U-Pb', format = 1) ``` -------------------------------- ### isochron() Source: https://context7.com/pvermees/isoplotr/llms.txt Fits isochron models to geochronological data. Supports different isotopic systems (Re-Os, U-Pb, Rb-Sr) and includes options for overdispersion and plotting. ```APIDOC ## isochron() ### Description Fits isochron models to geochronological data, supporting various isotopic systems and model complexities. ### Usage isochron(data, model = 1, plot = TRUE) ### Parameters - `data`: The input geochronological data (e.g., ReOs, UPb, RbSr). - `model`: The isochron model to use (e.g., 1 for standard, 3 for overdispersion). - `plot`: Logical, whether to generate a plot of the isochron. ### Examples ```r # Re-Os isochron, overdispersion model 3 (add geological scatter) isochron(ReOs, model = 3) # U-Pb isochron on Tera-Wasserburg coordinates isochron(UPb) # Suppress plot; capture results fit <- isochron(RbSr, plot = FALSE) cat('Rb-Sr isochron age:', fit$age[1], '±', fit$age[2], 'Ma\n') cat('MSWD:', fit$mswd, '\n') ``` ``` -------------------------------- ### radialplot() Source: https://context7.com/pvermees/isoplotr/llms.txt Generates a Galbraith radial plot for heteroscedastic age data, with options to overlay mixture models and customize plot appearance. ```APIDOC ## radialplot() ### Description Visualises a set of ages with different precisions on Galbraith's radial plot, and optionally overlays finite or continuous mixture models. ### Usage radialplot(data, transformation = NULL, type = 1, show.numbers = FALSE, k = NULL, z0 = NULL, from = NULL, to = NULL, plot = TRUE) ### Parameters - `data`: The input age data (e.g., FT1, ArAr, UPb). - `transformation`: Optional transformation to apply ('log'). - `type`: Plotting type (e.g., 2 for U-Pb). - `show.numbers`: Logical, whether to show grain numbers. - `k`: Number of components for mixture models. - `z0`: Reference value for the radial axis. - `from`, `to`: Axis limits for the radial plot. - `plot`: Logical, whether to generate a plot. ### Examples ```r attach(examples) # Fission track radial plot with central age radialplot(FT1) # Ar-Ar radial plot with log transformation radialplot(ArAr, transformation = 'log') # U-Pb radial plot (206Pb/238U ages), show grain numbers radialplot(UPb, type = 2, show.numbers = TRUE) # Finite mixture model: identify 2 age components radialplot(FT1, k = 2) # Custom axis limits and reference age radialplot(FT1, z0 = 100, from = 50, to = 300) ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.