[R] Error: Cannot use `+.gg()` with a single argument.
Ana Marija
@okov|c@@n@m@r|j@ @end|ng |rom gm@||@com
Fri May 8 04:17:56 CEST 2020
Hello,
I got this error:
Error: Cannot use `+.gg()` with a single argument. Did you
accidentally put + on a new line?
After running this:
data(murders)
library(ggplot2)
library(dplyr)
library(ggplot2)
ggplot(data=murders)
#define the slope of the line
r<-murders %>% summarize(rate=sum(total)/sum(population)*10^6) %>%.$rate
#mamke the plot
murders %>% ggplot(aes(population/10^6,total,label=abb))+
+geom_abline(intercept = log10(r),lty=2,color="darkgrey")+
+geom_point(aes(col=region), size=3)+
+geom_text_repel()+
+scale_x_log10()+
+scale_y_log10()+
+xlab("Populations in millions (log scale)")+
+ylab("Total number of murders (log scale)")+
+ggtitle("US Gun Murders in US 2010")+
+scale_color_discrete(name="Region")+
+theme_economist()
Is this an issue with my dplyr? Or how I can fix this code in order to work?
Thanks
Ana
More information about the R-help
mailing list