Session Ready
Exercise

Numeric defaults

cut_by_quantile() converts a numeric vector into a categorical variable where quantiles define the cut points. This is a useful function, but at the moment you have to specify five arguments to make it work. This is too much thinking and typing.

By specifying default arguments, you can make it easier to use. Let's start with n, which specifies how many categories to cut x into.

A numeric vector of the number of visits to Snake River is provided as n_visits.

Instructions
100 XP
  • Update the definition of cut_by_quantile() so that the n argument defaults to 5.
  • Remove the n argument from the call to cut_by_quantile().