Skip to content

ggplot using scale_x_date gives Error in seq.int(r1$year, to$year, by)

2 messages · Hadley Wickham, Aidan Corcoran

#
Hi Aidan,

str is your friend:
'data.frame':	9 obs. of  3 variables:
 $ Date    : chr  "2011-12-23" "2011-12-30" "2012-01-06" "2011-12-23" ...
 $ variable: Factor w/ 3 levels "Price","Yield",..: 1 1 1 2 2 2 3 3 3
 $ value   : num  86.78 86.04 86.44 9.74 9.54 ...

You haven't turned the Date variable into an actual date yet.  Try:

g$Date <- as.Date(g$Date)

Hadley

On Fri, Jan 6, 2012 at 9:12 AM, Aidan Corcoran
<aidan.corcoran11 at gmail.com> wrote:

  
    
#
Thanks Hadley, of course I should have spotted that.
On Fri, Feb 10, 2012 at 12:46 PM, Hadley Wickham <hadley at rice.edu> wrote: