Skip to contents

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)
#> [1] "TITLE \nSOLUTION 1  30a9e918\n        units   ppm\n        temp    12.500000\n        pH      7.790000\n        Fe.2.   0.980000\n        Mn      0.370000\n        C.4.    177.000000\n        Ca      101.000000\n        Mg      7.260000\n        Na      16.300000\n        K       1.320000\n        N..3.   0.100000\n        N.3.    0.005000\n        N.5.    0.025000\n        Cl      35.000000\n        S.6.    120.000000\n        Br      0.060000\n        P       0.170000\n        B       0.010000\nSOLUTION 2  1a0885dd\n        units   ppm\n        temp    11.500000\n        pH      7.730000\n        Fe.2.   3.400000\n        Mn      0.240000\n        C.4.    370.000000\n        Ca      99.100000\n        Mg      13.800000\n        Na      284.000000\n        K       4.030000\n        N..3.   1.000000\n        N.3.    0.005000\n        N.5.    0.025000\n        Cl      490.000000\n        S.6.    25.000000\n        Br      0.420000\n        P       0.260000\n        B       0.140000\nSOLUTION 3  7a50a2a2\n        units   ppm\n        pH      6.860000\n        Fe.2.   4.300000\n        Mn      0.560000\n        C.4.    196.000000\n        Ca      85.300000\n        Mg      14.500000\n        Na      35.500000\n        K       1.900000\n        N..3.   5.700000\n        N.3.    0.005000\n        N.5.    0.025000\n        Cl      45.000000\n        S.6.    150.000000\n        Br      0.120000\n        P       0.370000\n        B       0.100000\nSOLUTION 4  603d9e1f\n        units   ppm\n        temp    13.600000\n        pH      7.440000\n        Fe.2.   14.000000\n        Mn      0.580000\n        C.4.    262.000000\n        Ca      290.000000\n        Mg      45.700000\n        Na      986.000000\n        K       7.610000\n        N..3.   2.500000\n        N.3.    0.005000\n        N.5.    0.025000\n        Cl      2200.000000\n        S.6.    11.000000\n        Br      1.400000\n        P       0.200000\n        B       0.060000\nSOLUTION 5  3e5e5b83\n        units   ppm\n        temp    10.800000\n        pH      7.980000\n        Fe.2.   0.090000\n        Mn      0.010000\n        C.4.    223.000000\n        Ca      7.880000\n        Mg      12.800000\n        Na      77.000000\n        K       5.930000\n        N..3.   0.180000\n        N.3.    0.030000\n        N.5.    0.025000\n        Cl      51.000000\n        S.6.    3.000000\n        Br      0.025000\n        P       0.020000\n        B       0.220000\nSOLUTION 6  a03ace20\n        units   ppm\n        temp    11.400000\n        pH      8.820000\n        Fe.2.   3.100000\n        Mn      0.160000\n        Ca      97.800000\n        Mg      10.500000\n        Na      15.800000\n        K       2.390000\n        N..3.   3.300000\n        N.3.    0.005000\n        N.5.    0.025000\n        Cl      13.000000\n        S.6.    17.000000\n        Br      0.025000\n        P       0.030000\n        B       0.060000\nSOLUTION 7  e127a3ca\n        units   ppm\n        temp    10.700000\n        pH      7.590000\n        Fe.2.   2.800000\n        Mn      0.730000\n        C.4.    287.000000\n        Ca      53.900000\n        Mg      7.680000\n        Na      192.000000\n        K       2.120000\n        N..3.   4.400000\n        N.3.    0.005000\n        N.5.    0.025000\n        Cl      290.000000\n        S.6.    6.100000\n        Br      0.180000\n        P       0.480000\n        B       0.060000\nEND"