why does this code fail?

# Return the summary of missingness in each variable, grouped by Month, in the `airquality` dataset
airquality %>% group_by(Month) %>% miss_var_summary(airquality)

The correct shouldn't include airquality again. The wrong message is Warning message: the condition has length > 1 and only the first element will be used
Error: argument is not interpretable as logical

How to interpret this wrong message?

You're trying to pipe the argument in when you don't need to. The pipe, %>% passes what's on the left in as thefirst argument of the function on the right. What your code is doing is essentially this:

airquality2 <- group_by(airquality, Month)
miss_var_summary(airquality2, airquality)

What you want to do is this:

airquality %>%
  group_by(Month) %>%
  miss_var_summary()

(Which is the exact example from the miss_var_summary() help page)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.