Rainbow Deals - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Creating functions
If statements
Summary
22. Exercise 4

Instruction

Great job!

Finally, let's check which branch has the most opened accounts per client. In other words, which branch does the best job of meeting or exceeding Solbank's KPI?

Exercise

Create a function named most_opened_accounts_per_client that takes one argument: df, the data frame we'll be using (bank_branches_2017 or bank_branches_2018). This function should return the name of the branch with the most opened accounts per client (a ratio of two columns).

For each branch, we can calculate accounts_per_client as follows:

df$opened_accounts/df$number_of_clients

Stuck? Here's a hint!

You can use this expression to compute the number of accounts per client.

df$accounts_per_client <- df$opened_accounts/df$number_of_clients