How to insert data for graphing in ggplot

Asked

Viewed 248 times

3

I want to make a line chart with ggplot, but this message appears:

Error: Don’t know how to add geom_point to a Plot

Follow the pattern I’m doing:

a<-c(4.9, 4.4, 4.2, 3.9, 3.7, 3.5, 3.1, 3, 2.9, 3, 2.8, 2.7, 2.6, 2.5)
b<-c(0.97, 1.13, 1.19, 1.14, 1.16, 1.25, 1.24, 1.46, 1.62, 1.94, 1.36, 1.91, 1.8, 1.89)
Ano<-c(1999:2012)
dados<-data.frame(a,b,Ano)
ggplot(dados, aes(x=Ano,y=a))
+geom_point

1 answer

3

Only the parentheses were left after geom_point, since geom_point is a function you should call:

ggplot(dados, aes(x=Ano,y=a)) + geom_point()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.