Question: Problem 1 Write one expression using dplyr functions and the %>% operator to create the summary table below, and arrange it based on the customer

Problem 1 Write one expression using dplyr functions and the %>% operator to create the summary table below, and arrange it based on the customer state. This table contains the number of claims, average claim amount (total_claim_amount variable), and average customer lifetime value by customer_state and months_since_last_claim binned into 12 month categories.

Hint: You will need to create the month_category variable using cut_width() before you calculate the summaries by groups.

## summarise() regrouping output by customer_state (override with .groups argument)

## # A tibble: 15 x 5

## # Groups: customer_state [5]

## customer_state month_category n_claims avg_claim_amount avg_clv

## ## 1 Arizona [0,12] 553 1399. 8046.

## 2 Arizona (12,24] 365 1408. 7849.

## 3 Arizona (24,36] 263 1409. 8612.

## 4 Nevada [0,12] 260 1437. 8226.

## 5 Nevada (12,24] 202 1384. 8325.

## 6 Nevada (24,36] 139 1402. 8664.

## 7 California [0,12] 977 1400. 8206.

## 8 California (12,24] 712 1423. 8009.

## 9 California (24,36] 461 1406. 8202.

## 10 Oregon [0,12] 824 1410. 8329.

## 11 Oregon (12,24] 569 1420. 8307.

## 12 Oregon (24,36] 370 1410. 8913.

## 13 Washington [0,12] 241 1412. 7916. 1

## 14 Washington (12,24] 195 1373. 8541.

## 15 Washington (24,36] 118 1445. 7725.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!