function for pulling dayfactors from soliTOC file Creates column called factor with respective dayfactors. Does not yet apply them. Measurements are grouped with preceding repeated measurements of standard sample(s). If multiple repeated standard measurements, the standard is averaged for each set. A dayfactor is calculated for each set based on the average standard measurement and the theoretical value. The dayfactor is applied to all following samples, until a new set of standards is detected. Lets say, this is a small measurement file. Standards were named "S". This function will aggregate the measurements as follows: S-S-S-A-B-C-D-E-F-G-S-S-S-H-I-J-K-L 1-1-1-1-1-1-1-1-1-1-2-2-2-2-2-2-2-2 Then, factor_1 would be calculated as S_acutal/S1 and applied to all samples. A (sub)string of the sample names that the user wants to get returned needs to be provided. [Stable]

get_dayfactors(
  dataset,
  ID_col = "Name",
  std_id = "caco3",
  value_col = "TC  [%]",
  actual = 12,
  keep_batch = F
)

Arguments

dataset

Exported soliTOC csv file

std_id

Identifier of the standards for dayfactor calculation (default is caco3)

value_col

Column that contains measurement of standard (default is 'TC %', as caco3 should not contain OC, so this captures all released C)

actual

Theoretical standard concentration in wt-% (default for caco3 is 12)

keep_batch

Logical: Function creates helper variable "batch" to assign dayfactors. Should this be kept? Default is FALSE. Used mostly for debug.

IC_col

Sample names column. Should also include standard identifiers (Default is Name, as in soliTOC software)