Skip to content

Instantly share code, notes, and snippets.

@njtierney
Created February 23, 2026 00:32
Show Gist options
  • Select an option

  • Save njtierney/de81fa4dea956e46bdec2d1c930a2b35 to your computer and use it in GitHub Desktop.

Select an option

Save njtierney/de81fa4dea956e46bdec2d1c930a2b35 to your computer and use it in GitHub Desktop.
# based on RO water
gypsum <- function(litres) litres * (0.56 / 14)
ca_cl <- function(litres) litres * (2.66 / 14)
epsom <- function(litres) litres * (0.84 / 14)
acid <- function(litres) litres * (2 / 14)

gypsum(7)
#> [1] 0.28
ca_cl(7)
#> [1] 1.33
epsom(7)
#> [1] 0.42
acid(7)
#> [1] 1

water_salts <- function(litres){
    cli::cli_h1("Water additions for {.pkg {litres}} Litres")
    cli::cli_ul(
        c(
            "Gypsum: {.pkg {gypsum(litres)}g}",
            "Calcium Chloride: {.pkg {ca_cl(litres)}g}",
            "Epsom Salts: {.pkg {epsom(litres)}g}",
            "Lactic Acid (88% concetrate): {.pkg {gypsum(litres)}ml}"
        )
    )
}

water_salts(10)
#> 
#> ── Water additions for 10 Litres ───────────────────────────────────────────────
#> • Gypsum: 0.4g
#> • Calcium Chloride: 1.9g
#> • Epsom Salts: 0.6g
#> • Lactic Acid (88% concetrate): 0.4ml

Created on 2026-02-23 with reprex v2.1.1

Session info

sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.5.2 (2025-10-31)
#>  os       macOS Tahoe 26.2
#>  system   aarch64, darwin20
#>  ui       X11
#>  language (EN)
#>  collate  en_US.UTF-8
#>  ctype    en_US.UTF-8
#>  tz       Australia/Hobart
#>  date     2026-02-23
#>  pandoc   3.6.3 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown)
#>  quarto   1.7.31 @ /usr/local/bin/quarto
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  cli           3.6.5   2025-04-23 [1] CRAN (R 4.5.0)
#>  digest        0.6.39  2025-11-19 [1] CRAN (R 4.5.2)
#>  evaluate      1.0.5   2025-08-27 [1] CRAN (R 4.5.0)
#>  fastmap       1.2.0   2024-05-15 [1] CRAN (R 4.5.0)
#>  fs            1.6.6   2025-04-12 [1] CRAN (R 4.5.0)
#>  glue          1.8.0   2024-09-30 [1] CRAN (R 4.5.0)
#>  htmltools     0.5.9   2025-12-04 [1] CRAN (R 4.5.2)
#>  knitr         1.51    2025-12-20 [1] CRAN (R 4.5.2)
#>  lifecycle     1.0.5   2026-01-08 [1] CRAN (R 4.5.2)
#>  otel          0.2.0   2025-08-29 [1] CRAN (R 4.5.0)
#>  reprex        2.1.1   2024-07-06 [1] CRAN (R 4.5.0)
#>  rlang         1.1.7   2026-01-09 [1] CRAN (R 4.5.2)
#>  rmarkdown     2.30    2025-09-28 [1] CRAN (R 4.5.0)
#>  rstudioapi    0.18.0  2026-01-16 [1] CRAN (R 4.5.2)
#>  sessioninfo   1.2.3   2025-02-05 [1] CRAN (R 4.5.0)
#>  withr         3.0.2   2024-10-28 [1] CRAN (R 4.5.0)
#>  xfun          0.56    2026-01-18 [1] CRAN (R 4.5.2)
#>  yaml          2.3.12  2025-12-10 [1] CRAN (R 4.5.2)
#> 
#>  [1] /Users/nick_1/Library/R/arm64/4.5/library
#>  [2] /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment