plot.default does not accept a data argument, so it is best to go to with :
mynei %>% select(Emissions, year) %>% group_by(year) %>% summarise (total=sum(Emissions))%>% with(plot(year, total))
If someone missed @aosmith's comment on the question, plot.formula has a data argument, but of course formula is the first argument, so we need to use . to put data to the right place. So another option
... %>% plot(total ~ year, data = .)
Of course, ggplot takes data as the first argument, so to use ggplot do:
... %>% ggplot(aes(x = year, y = total)) + geom_point()
lattice::xyplot is similar to plot.formula : there is a data argument, but it is not the first, therefore:
... %>% xyplot(total ~ year, data = .)
Check the documentation and make sure you are using it . if data not the first argument. If there is no data argument at all, using with is a good job.
source share