Skip to content
Prev 383717 / 398502 Next

Error: Cannot use `+.gg()` with a single argument.

Hello,

Richard's answer solves the problem, I'm writing about details in the 
OP's post.

Ana, your code example is missing some library() calls:

library(ggplot2)
library(ggrepel)
library(ggthemes)
library(dplyr)

# and where to find the data set
data(murders, package = "dslabs")


As for the dplyr pipe, you end it with .$rate to pull only that column's 
value, the following avoids that construct and is, I believe, more 
idiomatic:

#define the slope of the line
r <- murders %>%
   summarize(rate = sum(total)/sum(population)*10^6) %>%
   pull(rate)


Hope this helps,

Rui Barradas


?s 04:27 de 08/05/20, Richard M. Heiberger escreveu: