Title: | R Package for Preparing Lab Samples as PHREEQC Input for Project GeoSalz |
---|---|
Description: | R Package for Preparing Lab Samples as PHREEQC input for project GeoSalz. |
Authors: | Michael Rustler [aut, cre] , Hauke Sonnenberg [aut] , Dwight Baldwin [ctb] , GeoSalz [fnd], Kompetenzzentrum Wasser Berlin gGmbH (KWB) [cph] |
Maintainer: | Michael Rustler <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-11-10 05:46:42 UTC |
Source: | https://github.com/KWB-R/geosalz.phreeqc |
Add solution id
add_solution_id(samples)
add_solution_id(samples)
samples |
data.frame with samples in wide format, i.e. parameters are columns and each row is one samole |
add "solution_id"
Convert Simulation Results to list
convert_simulations_to_list(simulations)
convert_simulations_to_list(simulations)
simulations |
tibble with simulation results as rewtrieved by
|
list with simulation results in structure for export to EXCEL
Convert to numeric Laboratory Values
convert_to_numeric_lab_values( samples_tidy, country = "en", detLimFactorBelow = 0.5, ... )
convert_to_numeric_lab_values( samples_tidy, country = "en", detLimFactorBelow = 0.5, ... )
samples_tidy |
data.frame with samples in tidy format, i.e. parameters are columns and each row is one value |
country |
"en" if value is given in English format (decimal point ".", thousands separator ",") or "de" if value is given in German format (decimal point ",", thousands separator "."). |
detLimFactorBelow |
actor by which detection limit is multiplied in order to get a valid value when the value was below the detection limit. Default value: 0.5 |
... |
additional arguments passed to hsLabValToVal |
data.frame with additional columns "outOfLimit" (with "<" or ">" sign) and "numericValue"
Path to File Stored in Package
package_file(...)
package_file(...)
... |
segments of path to file, in the simplest form just a file name |
full path to file within "extdata" folder of the installed package
Prepare PHREEQC Solutions Input File
prepare_solutions_input(samples_tidy, title = "", min_spaces = 3)
prepare_solutions_input(samples_tidy, title = "", min_spaces = 3)
samples_tidy |
data.frame with samples in tidy format, i.e. parameters are columns and each row is one value |
title |
user defined title (default: "") |
min_spaces |
minimum spaces after parameter name based on longest parameter name (default: 3 spaces) |
input text to be used as PHREEQC input
file_samples <- system.file("extdata/phreeqc-input.csv", package = "geosalz.phreeqc") samples <- read.csv2(file_samples) samples_tidy <- geosalz.phreeqc::tidy_samples(samples) %>% geosalz.phreeqc::convert_to_numeric_lab_values() prepare_solutions_input(samples_tidy)
file_samples <- system.file("extdata/phreeqc-input.csv", package = "geosalz.phreeqc") samples <- read.csv2(file_samples) samples_tidy <- geosalz.phreeqc::tidy_samples(samples) %>% geosalz.phreeqc::convert_to_numeric_lab_values() prepare_solutions_input(samples_tidy)
Read phreeqc output text file into a nested list structure
read_output_file(file)
read_output_file(file)
file |
full path to phreeqc output file. Template:
|
Read Simulations
read_simulations(phreeqc_output)
read_simulations(phreeqc_output)
phreeqc_output |
vector with lines of PHREEQC output file |
returns list with elements "end_of_simulations_seconds",input and output
Remove Missing Parameters
remove_missing_samples( samples_tidy, pattern_missing = "n\\.\\s?a\\.|-", col_value = "value" )
remove_missing_samples( samples_tidy, pattern_missing = "n\\.\\s?a\\.|-", col_value = "value" )
samples_tidy |
data.frame with samples in tidy format, i.e. parameters are columns and each row is one value |
pattern_missing |
remove samples marked "n. a." or "- " |
col_value |
value column (default: "value") |
data.frame without missing samples
Tidy Samples
tidy_samples(samples)
tidy_samples(samples)
samples |
data.frame with samples in wide format, i.e. parameters are columns and each row is one sample. Coerce samples data.frame to as.character to address potential input format error |
data.frame with samples in tidy format, i.e. parameters are columns and each row is one value
Remove Empty Elements at the Start or End of a Vector
trim_vector(x)
trim_vector(x)
x |
vector of character |
x
with empty elements at the beginning and end of x
being removed