[R] Date problem

natalia norden norden at cict.fr
Tue Mar 14 19:30:39 CET 2006


Hello,
I have some "stupid" problems managing "date" data.
I have a colomn "date", which I converted from a character representation:

for example:
a="26/02/06"
date=strptime(a,format="%d/%m/%y")

For one part of the analysis, I'm interested only in the month and the 
year, so I did:

m.y=strftime(date,format="%m/%y")

This returns me "02/06", but this is an object of class "character" and 
I can't convert it into an object of class "Date". Doing 
strptime(m.y,format="%m/%y") or as.Date(m.y,format="%m/%y") returns me NA

How can a convert this colomn "m.y" in a Date class?

Actually, I need it to plot fruiting data against time (month and year).
Because I have many values of seeds in a month, I used the function tapply:
seeds=tapply(data$seed,data$m.y,sum)
But plot(x=names(seeds),y=seeds) doesn't work. Does anyone know an 
easier way?

Thank you for your time,
natalia




More information about the R-help mailing list