Skip to contents

stat_X function for descriptive and predictive statistics on single ion precision. stat_R function for descriptive and predictive statistics on isotope ratios (R) precision with appropriate error propagation.

Usage

stat_X(
  .IC,
  ...,
  .X = NULL,
  .N = NULL,
  .species = NULL,
  .t = NULL,
  .stat = point::names_stat_X$name,
  .label = "none",
  .meta = FALSE,
  .output = "sum"
)

stat_R(
  .IC,
  .ion1,
  .ion2,
  ...,
  .nest = NULL,
  .X = NULL,
  .N = NULL,
  .species = NULL,
  .t = NULL,
  .stat = point::names_stat_R$name,
  .label = "none",
  .output = "sum",
  .zero = FALSE
)

Arguments

.IC

A tibble containing processed ion count data.

...

Variables for grouping.

.X

A variable constituting the ion count rate (defaults to variables generated with read_IC().)

.N

A variable constituting the ion counts (defaults to variables generated with read_IC().).

.species

A variable constituting the species analysed (defaults to variables generated with read_IC().).

.t

A variable constituting the time of the analyses (defaults to variables generated with read_IC().).

.stat

Select statistics (e.g. c("M", "RS"), see the tables point::names_stat_X and point::names_stat_R for the full selection of statistics available (default uses all statistic transformations).

.label

A character string indicating whether variable names are latex ("latex") or webtex ("webtex") compatible. Will be extended in the future default = NULL.

.meta

Logical whether to preserve the metadata as an attribute (defaults to TRUE).

.output

A character string for output as summary statistics ("sum"); statistics only ("stat"); and statistics with the original data ("complete") default = "sum".

.ion1

A character string constituting the heavy isotope ("13C").

.ion2

A character string constituting the light isotope ("12C").

.nest

A variable hat identifies a series of analyses to calculate external precision.

.zero

A character string that determines whether analyses with zero count measurements will be removed from the calculations.

Value

A tibble::tibble containing descriptive and predictive statistics for ion counts and isotope ratios. The naming convention depends on the argument latex; if set to FALSE, variable names concerning statistics will consist of an abbreviation pasted together with the input variable names of Xt.

Details

These functions are a convenient wrapper to calculate the statistics pertaining to the precision of pulsed ion count data (e.g. secondary ion mass spectrometry). The statistics can either be calculated for single ions or isotope ratios, and include observed and predicted (Poisson) statistics. Calculations for isotope ratios include proper error propagation. For more information on the usage as well as the mathematics behind these functions see vignette("IC-precision", package = "point").

Examples

# Use point_example() to access the examples bundled with this package

# raw data containing 13C and 12C counts on carbonate
tb_rw <- read_IC(point_example("2018-01-19-GLENDON"), meta = TRUE)

# Processing raw ion count data
tb_pr <- cor_IC(tb_rw)

# Single ion descriptive an predictive statistics for all measured ions
stat_X(tb_pr, file.nm)
#> # A tibble: 21 × 12
#>    file.nm         species.nm n_t.nm tot_N.pr M_Xt.pr S_Xt.pr RS_Xt.pr SeM_Xt.pr
#>    <chr>           <chr>       <int>    <dbl>   <dbl>   <dbl>    <dbl>     <dbl>
#>  1 2018-01-19-GLE… 12C          3900 41718475  3.06e4 2738.       8.94   43.8   
#>  2 2018-01-19-GLE… 12C13C       3900    15254  1.12e1    9.17    81.9     0.147 
#>  3 2018-01-19-GLE… 12C14N       3900   511093  3.75e2  220.      58.7     3.53  
#>  4 2018-01-19-GLE… 12C2         3900   686187  5.04e2  341.      67.7     5.46  
#>  5 2018-01-19-GLE… 13C          3900   458139  3.36e2   42.5     12.6     0.680 
#>  6 2018-01-19-GLE… 13C14N       3900     9158  6.72e0    5.63    83.8     0.0902
#>  7 2018-01-19-GLE… 40Ca16O      3900 18082538  1.33e4 1856.      14.0    29.7   
#>  8 2018-01-19-GLE… 12C          3900 72956119  5.35e4 4073.       7.61   65.2   
#>  9 2018-01-19-GLE… 12C13C       3900    10786  7.92e0    7.48    94.4     0.120 
#> 10 2018-01-19-GLE… 12C14N       3900   362709  2.66e2  114.      42.9     1.83  
#> # … with 11 more rows, and 4 more variables: hat_S_N.pr <dbl>,
#> #   hat_RS_N.pr <dbl>, hat_SeM_N.pr <dbl>, chi2_N.pr <dbl>

# Descriptive an predictive statistics for 13C/12C ratios
stat_R(tb_pr, "13C", "12C", file.nm, .zero = TRUE)
#> # A tibble: 3 × 13
#>   file.nm       n_R_t.nm M_R_Xt.pr S_R_Xt.pr RS_R_Xt.pr SeM_R_Xt.pr RSeM_R_Xt.pr
#>   <chr>            <int>     <dbl>     <dbl>      <dbl>       <dbl>        <dbl>
#> 1 2018-01-19-G…     3900    0.0110  0.00102        93.0   0.0000163         1.49
#> 2 2018-01-19-G…     3900    0.0110  0.000779       70.8   0.0000125         1.13
#> 3 2018-01-19-G…     3900    0.0110  0.000733       66.5   0.0000117         1.06
#> # … with 6 more variables: hat_S_R_N.pr <dbl>, hat_RS_R_N.pr <dbl>,
#> #   hat_SeM_R_N.pr <dbl>, hat_RSeM_R_N.pr <dbl>, chi2_R_N.pr <dbl>,
#> #   ratio.nm <chr>

# Descriptive an predictive statistics for 13C/12C ratios (external)
stat_R(tb_pr, "13C", "12C", sample.nm, file.nm, .nest = file.nm,
       .zero = TRUE)
#> # A tibble: 1 × 13
#>   sample.nm        n_R_t.nm M_R_M_Xt.pr S_R_M_Xt.pr RS_R_M_Xt.pr SeM_R_M_Xt.pr
#>   <chr>               <int>       <dbl>       <dbl>        <dbl>         <dbl>
#> 1 Belemnite,Indium        3      0.0110   0.0000203         1.85     0.0000117
#> # … with 7 more variables: RSeM_R_M_Xt.pr <dbl>, hat_S_R_tot_N.pr <dbl>,
#> #   hat_RS_R_tot_N.pr <dbl>, hat_SeM_R_tot_N.pr <dbl>,
#> #   hat_RSeM_R_tot_N.pr <dbl>, chi2_R_tot_N.pr <dbl>, ratio.nm <chr>