calculiva (R)

Home improvement estimators from Calculiva, as an R package: mulch, topsoil and fill, and sod. Each result is a planning quantity (volume, bags, bulk, pallets, pieces, weight, trips), computed with the method described at https://calculiva.com/how-we-calculate/.

This package is a line-by-line port of the Go module github.com/calculiva/calculiva-go, version 0.3.0. Its tests replay tests/testthat/vectors.json, a set of test vectors generated by running that Go module: same inputs, same outputs, same error fields and messages.

Base R only; testthat and jsonlite are used by the tests.

# install.packages("remotes")
remotes::install_github("calculiva/calculiva-r")

Example

library(calculiva)
ft <- calculiva_units()$foot
inch <- calculiva_units()$inch

# Two 40 x 3 ft beds topped up from 1 in to 3 in, bought in 2 cu ft bags.
bed <- list(id = "front-bed", kind = list(type = "bed", l = 40 * ft, w = 3 * ft, count = 2),
            target = 3 * inch, existing = 1 * inch)
plan <- mulch_new_plan(list(areas = list(bed), bagSize = 2))
sprintf("%.1f cu ft, %.0f bags", plan$totals$cuFt, plan$buy$bags)
#> [1] "40.0 cu ft, 20 bags"

All lengths are millimetres. Inputs and results are named lists; a NULL value means that the input it depends on was not entered. Invalid input signals a calculiva_input_error condition whose field names the offending field.

What is in it

Functions Calculator
mulch_new_rules, mulch_new_plan, mulch_new_ring_guidance, mulch_check_ring, mulch_coverage Mulch calculator
soil_new_rules, soil_new_plan, soil_area_of, soil_bag_cu_ft, soil_coverage Soil calculator
sod_new_rules, sod_new_input, sod_new_plan, sod_lay_rect, sod_format_table Sod calculator
calculiva_units, soil_constants, mulch_constants, sod_constants

Every constant carries, in the source, its data sheet, the public source it was read on and the date it was verified, exactly as in the Go module. Material weights, bag and wheelbarrow sizes and sod allowances are not shipped: they are inputs of the user. The constants registry of the Go module (ConstantsCSV) is not part of this package; the sources are listed at https://calculiva.com/data-sources/.

Licence

MIT (LICENSE, LICENSE.md), as the Go module.