I have a problem that puzzles me a bit today. When loading off data from a
database and plotting using ggplot2, I wish to present data as a time series
with time of day. The code is text-book like as shown below:

# Fetch data
con <- dbConnect(dbDriver("MySQL"), user="user", password = "pwd",
dbname="db")
data <- dbGetQuery(con, "select PU, DateTime from rep;")
data$time <- as.POSIXct(data$DateTime)
attach(data)

# Plot Data
p <- ggplot(data, aes(x=time, colour=PU ) ) +
ylim( c(0, max(PU)) ) +
geom_line( aes(x=time, PU ) )

p

It starts plotting and terminates before anything is drawn on the canvas.
The error message on the terminal is:

Error in seq.int(0, to - from, by) : 'to' must be finite

The DateTime coloumn in MySQL is of type datetime Is it a bug or a feature?



Thanks

ottar

	[[alternative HTML version deleted]]

