LoslegenKostenlos loslegen

Plot number of possible baskets

In this exercise, you will visually see how quickly the number of possible baskets grows as a function of the itemset size. This will illustrate one of the main challenges in Market Basket Analysis which is the large number of possible ways of creating a basket. You will be using here the stat_function(); this function allows you to specify within your ggplot() call which function you would like to plot by specifying the argument fun.

Diese Übung ist Teil des Kurses

Market Basket Analysis in R

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Define number of items in the set
n_items = ___

# Specify the function to be plotted
fun_combi = function(x) choose(___, ___)

# Plot the number of combinations
ggplot(data = data.frame(x = 0), mapping = aes(x = ___)) +
		stat_function(fun = ___) + xlim(0,n_items)
Code bearbeiten und ausführen