Need help with this code, not sure what is the issue here

Not sure the code chunk is not working with the error saying "You've supplied a <tbl_df> object"

penguins %>%
  drop_na(sex) %>%
  ggplot(data=penguins,aes(x=flipper_length_mm,y=body_mass_g))+
  geom_point(aes(color=species,
                 shape=species)) +
  facet_wrap(~sex)

Essentially


rahul_raj
12m
Not sure the code chunk is not working with the error saying "You've supplied a <tbl_df> object"

penguins %>%
  drop_na(sex)

has created a new tibble.

data=penguins

Is telling ggplot to ignore the new tibble.

Try

library(palmerpenguins)
penguins %>%
  drop_na(sex) %>%
  ggplot(aes(x=flipper_length_mm,y=body_mass_g))+
  geom_point(aes(color=species,
                 shape=species)) +
  facet_wrap(~sex)


Thank you! Its working now!
But can you explain how adding the library(palmerpenguins) fixed the issue, wanted to understand the mechanism for that

Actually read the comments, and now i have an understanding! Thanks for the help.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.