# load the phreeqc.dat database
phrLoadDatabaseString(phreeqc.dat)
# create ex2 if it doesn't exist
if (!file.exists("ex2")) writeLines(ex2, "ex2")
# run ex2
if (is.null(phrRunFile("ex2"))) {
cat("use phrGetSelectedOutput() to see results.\n")
}
unlink("ex2") # tidy up
Run the code above in your browser using DataLab