On Mon, Mar 31, 2003 at 01:40:23PM +0200, Ghosh Mini wrote: > > Dear all, > > Hope you are fine there. I want to know > > " Is it possible to treat Day,month and year seperately in a data frame in > R"
It's easy, if your date column is a POSIX*t date/time class. help(DateTimeClasses) should shed some light. > Means, suppose I want to take mean of data first by day wise and then by > month. Is it possible using R?? Use by() or tapply() with format(your.POSIX*t.object) for indicies, and it's pretty easy. Something like this, as a toy example... myData <- data.frame(numbers=1:20) myData$date <- as.POSIXct(paste(sep="-","2003",1:4,1:20)) myData #by day by(myData$numbers,as.character(format(myData$date,"%d")),sum) #by month by(myData$numbers,as.character(format(myData$date,"%m")),sum) Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 [EMAIL PROTECTED] ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
