[R] Help: From Excel date to R-date!

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Oct 21 19:39:34 CEST 2010


If those are the only formats and the dates are in the current 
timezone ...

> dates <- c("1/8/98 1:00", "1/8/98 23:00")
> as.POSIXct(dates, format = "%d/%m/%y %H:%M")
[1] "1998-08-01 01:00:00" "1998-08-01 23:00:00"

As for how to handle such a time series in R, it depends if it is a 
regular or irregular time series and what questions you want to ask.

On Thu, 21 Oct 2010, Amy Young-King wrote:

> Hi all,
>
> I am really new to dealing with Excel date and time formats to be used in R.
>
> I have an Excel exported data matrix in TXT format.
>
> One column, labeled DATE, is of the following format examples:
>
>
> 1/8/98 1:00
> 1/8/98 23:00
>
>
> to mean that the observation was made on 1st of August 1998 at 1AM and
> another
> observation made at 11PM. This is a time series example.
>
> How do I read in this column in R and convert it most appropriately in a
> format that
> R can handle and be utilized in fitting a time series model to the data?
>
> Thank you for your answers!
>
> Amy Young
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list