✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
An analyst wants the proportion of surge days within each sensor flag group, so that the proportions in each group add to 1. The analyst runs the code below and reports: “Only 15% of flagged days are surge days, compared with 10% of Normal days, so the flag barely matters.” Explain what has gone wrong in the code and describe how it should be changed. Then comment on the analyst's conclusion.
days |>
count(sensor_flag, surge) |>
mutate(prop = n / sum(n))
Output 1.5 Incorrect Output# A tibble: 4 × 4
sensor_flag surge n prop
<chr> <chr> <int> <dbl>
1 High No 36 0.15
2 High Yes 36 0.15
3 Normal No 144 0.6
4 Normal Yes 24 0.1
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!