Validating totals
In this lesson, you'll continue to work with the accounts data frame, but this time, you have a bit more information about each account. There are three different funds that account holders can store their money in. In this exercise, you'll validate whether the total amount in each account is equal to the sum of the amount in fund_A, fund_B, and fund_C. If there are any accounts that don't match up, you can look into them further to see what went wrong in the bookkeeping that led to inconsistencies.
dplyr is loaded and accounts is available.
Cet exercice fait partie du cours
Cleaning Data in R
Instructions
- Create a new column called
theoretical_totalthat contains the sum of the amounts in each fund. - Find the accounts where the
totaldoesn't match thetheoretical_total.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Find invalid totals
accounts %>%
# theoretical_total: sum of the three funds
___ %>%
# Find accounts where total doesn't match theoretical_total
___