MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Cleaning Data in R

Lihat Kursus

Petunjuk latihan

  • Create a new column called theoretical_total that contains the sum of the amounts in each fund.
  • Find the accounts where the total doesn't match the theoretical_total.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Find invalid totals
accounts %>%
  # theoretical_total: sum of the three funds
  ___ %>%
  # Find accounts where total doesn't match theoretical_total
  ___
Edit dan Jalankan Kode