DRDataRaft/ docs
GitHub ↗

H01 Understand a small policy delivery

H01Data, products and quality1 step

Use your current course session. Preparation and course runner · R script ↓

H01 Understand a small policy delivery

Goal: Recognize the three columns of our first dataset.

Prerequisites: Setup complete.

Each row represents an insurance policy. policy_id is its unique integer identifier; premium is a synthetic monthly amount in EUR. cancelled marks a cancellation. Dates and the precise rate definition come later, so this flag alone is not a KPI.

policies <- data.frame(
  policy_id = 1:6,
  premium = c(100, 150, 80, 200, 120, 90),
  cancelled = c(FALSE, FALSE, TRUE, FALSE, FALSE, FALSE)
)
print(policies)

stopifnot(nrow(policies) == 6L, sum(policies$premium) == 740)
stopifnot(identical(policies$policy_id, 1:6), sum(policies$cancelled) == 1L)

Expected result: Six rows and three columns; policy 3 is marked as cancelled.

Task: How many policies are marked, and what is the total premium? Try sum(policies$cancelled) and sum(policies$premium).

Show solution

One policy and EUR 740. The silent stopifnot checks confirm the result. Next, give this table a reusable product definition.

Search documentation

Search functions, packages and guides.