Description Usage Arguments Value
For every set of two products located on the list of discounts function calculates the minimum amount of items purchased. This value is a total number of bundles of a specific type and it is multiplied by a discount value for this bundle to get the total discount value. Those steps are repeated for every defined discount to create a final table of discounts.
1 | calculateDiscount(items, discounts)
|
items |
data.frame with all items that are purchased. Contains 2 columns: 'Item' with product name and 'Count' with the amount of items purchased |
discounts |
data.frame with all discounts for bundle of two products purchased together. Contains 3 columns: 'Item1', 'Item2' (product names) and Discount (applied to every pair of two defined products). |
Function returns a data.frame with 4 columns ("Item", "Count", "Discount"
and "Cost" - same format as in calculateSingleItemCost
function). Each row is
a seperate discount from a bundle of two products. The value in 'Discount' column is
created by combining the names of two products in a bundle. The value in Cost column
is negative to represent that the discount should be deducted from the final cost.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.