Working on the guided project: Creating an efficient Data Analysis Workflow part 2. Ran into and issue when trying to fill in the missing purchase values with a the average of that same column. The code is very simple and straightforward so why is this happening?
Remove all of the missing values from the user_submitted_review column
complete_sales <- sales >
filter(user_submitted_review != “NA”)
Calculate average purchase quantity
purchase_mean <- complete_sales >
filter(total_purchased != “NA”) >
Fill in missing values with the average
complete_sales <- complete_sales >
mutate(imputed_purchases = if_else(total_purchased == “NA”,
This is the error that appears :Error: Can’t use NA as column index with
[ at positions 1, 2, 3, 4, 5, and 4110 more.