user8284384
user8284384

Reputation:

GGPLOT with lines for factor on x-axis data not working

I have the following code which I am attempting to run to plot monthly counts against the month, for 4 different years to see trends in seasonal periods.

g <- ggplot(groups.byYearAndMonth,aes(y=number, x=month.Raised, group=year.Raised))
g <- geom_line()

I keep getting an error in the console stating:

Error in geom_point() + geom_line() : non-numeric argument to binary operator

The data has layout and format:

year.Raised  month.Raised  number
       2016           Nov       6

with the year as a numeric variable and the month and number as factors.

Upvotes: 0

Views: 168

Answers (1)

Dan
Dan

Reputation: 12074

The second line should be g<-g + geom_line().

Upvotes: 2

Related Questions