Skip to content
Prev 5541 / 15274 Next

How to seperate date and time into different columns?

Normally one wants to store time indexes as a single column so its
likely that this is not what you really want to do.  You may wish to
explain what your final objective is and why you want to do this.

However, if you must there are many ways and here is one  The first
two lines load chron and set up some input data.  Now that we have
some input the first line of the solution creates a chron object by
passing to chron the portion prior to the space and the portion after
the space and appending :00 to the latter.  The second line uses
month.day.year to get the date components and subtraction of the date
to get the times.
year month day     time
1 2008     4  17 16:01:00
2 2008     4  18 20:01:00

R News 4/1 has an relevant article.
On Fri, Jan 22, 2010 at 1:09 PM, FMH <kagba2006 at yahoo.com> wrote: