Guided Project: Creating An Efficient Data Analysis Workflow, Part 2 Error in replacing missing values with mean

Screen Link:

My Code:

complete_sales <- complete_sales %>% 
    imputed_purchases = if_else(, 

What I expected to happen:
A new column named imputed purchases would be created and the NA values would be replaced with the purchase mean.

What actually happened:

Error: Problem with `mutate()` input `imputed_purchases`.
x `false` must be a double vector, not an integer vector.
ℹ Input `imputed_purchases` is `if_else(, purchase_mean, total_purchased)`.

This is literally the code from the solution, and it still will not work for me. I know it is because the if_else function is seeing purchase_mean and total_purchased as two different class types, but how do I fix this? ?

Hello. I ran into the same problem. Changing the if_else() function into ifelse() may help. You will find this link helpful.