[R] lines and dates

Toby.Patterson@csiro.au Toby.Patterson at csiro.au
Thu Feb 5 04:17:47 CET 2004


As per the stuff on the list earlier, it looks like you probably need to
convert the POSIXlt's to POSIXct's 
Try: 

?as.POSIXct 



-----Original Message-----
From: Jean Eid [mailto:jeaneid at chass.utoronto.ca] 
Sent: Thursday, February 05, 2004 11:39 AM
To: r-help at stat.math.ethz.ch
Subject: [R] lines and dates 


Dear All,
I have the following data.frame

`data.frame':	1563 obs. of  4 variables:
 $ Model      :Class 'AsIs'  chr [1:40] "Astro" "Astro" "Astro" "Astro"
 $ Make       :Class 'AsIs'  chr [1:40] "Chevrolet" "Chevrolet"
 $ Production : num  11219 12384  1082  5409  5458 ...
 $ date       :`POSIXlt', format: chr  "2000-05-01" "2000-06-01"


The data frame contains production levels of some cars from 2000 to
2003. My question is about plotting production for  each  model. I have
a code that  outputs a plot for each model and it works fine.  However I
would like to plot couple of models together i.e when I do

plot(temp$date, temp$Production, type="n")
by(temp, list(temp$Model), function(x) lines(x[, "date"], x[,
"Production"]))

I get an error:
      Error in xy.coords(x, y) : x and y lengths differ

I believe that it has something to do with POSIXlt. when I issue a
length or NROW command on temp$date it returns the value 9.

any help is greatly appreciated,

Jean

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list