[R] Mean of dates

Achim Zeileis Achim.Zeileis at uibk.ac.at
Fri Apr 24 12:59:52 CEST 2015



On Fri, 24 Apr 2015, Jue Lin-Ye wrote:

> Dear fellow R-help members,
>
> If my data is
>
> YYYY MM DD HH
> 2015 04 24 01
> 2015 04 24 02
> 2015 04 24 06
>
> Where
>
> YYYY: year
> MM:month
> DD:day
> HH: hour
>
> How could I calculate the mean of the ISOdatetime(YYYY,MM,DD,HH,0,0) of
> these?

With the mean() method? On my machine:

R> mean(ISOdatetime(YYYY,MM,DD,HH,0,0))
[1] "2015-04-24 03:00:00 CEST"

hth,
Z

> Note: I set minutes and seconds to 0, as I don't have data for them.
>
> ?Thank you in advance!?
>
> -- 
> Jue Lin-Ye
>
> ---------------------------------------------------------------
> Civil Engineering phD candidate
> Maritime Engineering Laboratory (LIM)
> Universitat Politècnica de Catalunya (UPC)
> C/Jordi Girona 1-3, Barcelona 08034 (Spain)
> -----------------------------------------------------------------
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list