keep getting error : `data` must be a data frame, or other object coercible by `fortify()`, not an S3 object with class uneval

In fact, I'm a beginner. I want to make a graph using ggplot2.
But the error ( data must be a data frame, or other object coercible by fortify(), not an S3 object with class uneval ) is keeping. What should I do? (I want to use ed_di data to make a graph)
Thanks.

welfare1 <- welfare_new
welfare1 <- rename(welfare1,
ed = h01_g6,
di = h01_g8)
welfare1$ed <- ifelse(welfare1$ed == 1, NA, welfare1$ed)
table(welfare1$ed)

welfare1$di <- ifelse(welfare1$di == 0 | welfare1$di == 16, NA, welfare1$di)
table(welfare1$di)

qplot(welfare1$di)

ed_di <- welfare1 %>%
filter(!is.na(di) & !is.na(ed)) %>%
group_by(ed) %>%
summarise(n = n()) %>%
arrange(desc(n))

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

1 Like

look at the help for qplot. You have to supply it x, y and data. Something like

qplot(x = ed, y = di, data = welfare1)
1 Like

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