create_DataFile: Prepare input data for subsequent BayLum Analysis

View source: R/create_DataFile.R

create_DataFileR Documentation

Prepare input data for subsequent BayLum Analysis

Description

The function pre-processes input data from BIN/BINX file, XSYG files or RLum.Analysis objects for 'BayLum'. The parameters for the modelling are controlled by a to be supplied YAML configuration file (please read package vignette).

Usage

create_DataFile(config_file, verbose = TRUE)

Arguments

config_file

character (required): path to YAML configuration file; alternatively the config_file can be a list similar to the R representation of the imported YAML file. This enables on-the fly modifications

verbose

logical (with default): enable/disable terminal feedback

Details

The function uses a single configuration file based on the YAML format and operates in two modes:

(1) The YAML file contains the path to the files and the function attempts to import them. In such a case, all files must be thoroughly prepared (e.g., strictly follow the SAR protocol etc.).

(2) Alternatively, the YAML file contains no file paths but the data were imported and processed before create_DataFile() was called (recommended). Then the function is searching for objects with the sample name in the global environment. Example: samp1 <- Luminescence::read_BIN2R(...) with samp1 the sample name as specified in the YAML file.

For more details, please see the package vignette.

Value

Returns a list that can be processed by the modelling functions of 'BayLum'

  • LT (one list per sample); each list contains all L/T values for the corresponding sample;

  • sLT (one list per sample); each list contains all uncertainties on L/T values for the corresponding sample;

  • ITimes (one list per sample); each list contains irradiation time values for the corresponding sample;

  • dLab, a matrix containing in line i, the laboratory dose rate and its variance for sample i;

  • ddot_env, a matrix containing in line i, the environmental dose rate and its variance (excluding the common error terms) for sample i;

  • regDose (one list per sample); each list contains all regenerated doses;

  • J, a vector giving, for each BIN file, the number of aliquots selected for the analysis;

  • K, a vector giving, for each BIN file, the number of regenerative doses in the SAR protocol;

  • Nb_measurement, a vector giving, for each BIN file, the number of measurements;

  • SampleNames, a character vector with the sample names;

  • Nb_sample, the number of samples in the dataset

Function version

0.1.0

Author(s)

Sebastian Kreutzer, Institute of Geography, Ruprecht-Karl University of Heidelberg (Germany), in parts based on code by Claire Christophe , RLum Developer Team

See Also

write_YAMLConfigFile, yaml::read_yaml, Luminescence::read_BIN2R, Luminescence::read_XSYG2R, Luminescence::subset_SingleGrainData

Examples

##set path to YAML file
yaml_file <- system.file("extdata/example.yml", package = "BayLum")

samp1_file <- system.file("extdata/samp1/bin.bin", package = "BayLum")
samp2_file <- system.file("extdata/samp2/bin.bin", package = "BayLum")

## import BIN files
samp1 <- Luminescence::read_BIN2R(samp1_file, verbose = FALSE) |>
 subset(POSITION == 2 & GRAIN == 32)
samp2 <- Luminescence::read_BIN2R(samp2_file, verbose = FALSE) |>
 subset(POSITION == 2 & GRAIN == 32)

## create file
create_DataFile(yaml_file)


BayLum documentation built on June 22, 2024, 10:18 a.m.