Package 'geosalz.phreeqc'

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

Help Index


Add solution id

Description

Add solution id

Usage

add_solution_id(samples)

Arguments

samples

data.frame with samples in wide format, i.e. parameters are columns and each row is one samole

Value

add "solution_id"


Convert Simulation Results to list

Description

Convert Simulation Results to list

Usage

convert_simulations_to_list(simulations)

Arguments

simulations

tibble with simulation results as rewtrieved by read_simulations

Value

list with simulation results in structure for export to EXCEL


Convert to numeric Laboratory Values

Description

Convert to numeric Laboratory Values

Usage

convert_to_numeric_lab_values(
  samples_tidy,
  country = "en",
  detLimFactorBelow = 0.5,
  ...
)

Arguments

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

Value

data.frame with additional columns "outOfLimit" (with "<" or ">" sign) and "numericValue"


Path to File Stored in Package

Description

Path to File Stored in Package

Usage

package_file(...)

Arguments

...

segments of path to file, in the simplest form just a file name

Value

full path to file within "extdata" folder of the installed package


Prepare PHREEQC Solutions Input File

Description

Prepare PHREEQC Solutions Input File

Usage

prepare_solutions_input(samples_tidy, title = "", min_spaces = 3)

Arguments

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)

Value

input text to be used as PHREEQC input

Examples

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

Description

Read phreeqc output text file into a nested list structure

Usage

read_output_file(file)

Arguments

file

full path to phreeqc output file. Template: system.file("extdata/phreeqc_output.txt", package = "geosalz.phreeqc")


Read Simulations

Description

Read Simulations

Usage

read_simulations(phreeqc_output)

Arguments

phreeqc_output

vector with lines of PHREEQC output file

Value

returns list with elements "end_of_simulations_seconds",input and output


Remove Missing Parameters

Description

Remove Missing Parameters

Usage

remove_missing_samples(
  samples_tidy,
  pattern_missing = "n\\.\\s?a\\.|-",
  col_value = "value"
)

Arguments

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")

Value

data.frame without missing samples


Tidy Samples

Description

Tidy Samples

Usage

tidy_samples(samples)

Arguments

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

Value

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

Description

Remove Empty Elements at the Start or End of a Vector

Usage

trim_vector(x)

Arguments

x

vector of character

Value

x with empty elements at the beginning and end of x being removed