show_top_combos: Show Top TURF Combinations

View source: R/show_top_combos.R

show_top_combosR Documentation

Show Top TURF Combinations

Description

This function takes the output of turf() and filters the results to just the top n combinations according to the metric provided. Finally, the results are unnested into a single data frame.

Usage

show_top_combos(x, n = 5, metric = "reach")

Arguments

x

A turf object.

n

Number of combinations to show, default is 5.

metric

Metric to sort on, one of "reach" (default), "freq". If item weights were used then the options of "weight" and "value" are also available.

Value

A tibble.

Examples

x <- turf(
    FoodSample,
    items = 2:4,
    k = 1:3,
    item_weights = c(Bisque = 7.49, Chicken = 10.99, Tofu = 11.99)
)

show_top_combos(x, n = 2, metric = "reach")
show_top_combos(x, n = 2, metric = "freq")
show_top_combos(x, n = 2, metric = "weight")
show_top_combos(x, n = 2, metric = "value")


ttrodrigz/onezero documentation built on May 9, 2023, 2:59 p.m.