Build a dplyr pipeline that can be reviewed
Structure a data transformation pipeline into readable verbs and checks.
Create a market summary from raw orders while preserving reviewability. dplyr works as a grammar because each verb expresses one data move: filter rows, select columns, mutate variables, arrange order, group, summarise, and join. Not quite: compact code can be harder to audit when joins and filters change the population. 1. Name the grain Start with eligible_orders filter(status == "complete") and comment that rows are order-level. This tells reviewers what one row means before any aggregation. 2. Join deliberately Prepare current_customers filter(is_current) |> distinct(customer_id, .keep_all = TRUE) before left_join(). The lookup is made one-row-per-key before it can multiply orders. 3.…
Sign up free — one personalized lesson every day, matched to your role and goals.
Already have an account? Sign in