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]]
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
On Thu, Oct 21, 2010 at 1:31 PM, Amy Young-King <amy.young.king at gmail.com> 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! >For reading Excel files see this page: http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows and also read the Other Applications section of the date and time article in R News 4/1. Regarding your other questions google for: Time Series CRAN Task View -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com