Description Usage Arguments Value Examples
Find lowest-cost way to assemble units of different sizes to a certain total
1 2 | find_least_cost_partition(desired_dose, available_units, subset_col = NULL,
subset_val = NULL)
|
desired_dose |
the dose(s) required. |
available_units |
available sizes and costs; must have column names 'size' and 'cost' |
subset_col |
optionally, a column to select on. |
subset_val |
if subset_col is provided, the value to select on in that column. |
a data frame, with columns desired_dose
, used_dose
,
waste
, cost
, and cost.no.waste
1 2 3 4 5 | units <- data.frame(size = c(1000, 250, 200, 100, 50),
cost = c(40, 11.5, 8.5, 5.5, 4.4))
find_least_cost_partition(450, available_units = units)
temp <- find_least_cost_partition(sample(250:450, 10, replace = TRUE),
available_units = units)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.