Cited from the Book "Beginning Data Science in R"
data(cars)
> cars %>% plot(speed, dist, data = .)
Error in plot(speed, dist, data = .) : object 'speed' not found
The following works.
cars %>% plot(dist ~ speed, data = .)
or
cars %$% plot(speed, dist, data = .)
Explanation:
The data argument of plot() is used when the variables of the plot are specified as a formula. It is
combined with a formula that the data parameter of the plot() function is used.
No comments:
Post a Comment