[R-SIG-Finance] How to separate date and time into different columns?
Brian G. Peterson
brian at braverock.com
Fri Jan 22 19:18:15 CET 2010
FMH wrote:
> Dear All,
>
> I have a series of data in which the first column consist of a combination of date and time, for instance 17 April 2008 at 4.01pm, such data is recorded as:
>
> 4/17/2008 16:01
>
> I'd like to seperate it into four different columns which consist of Day, Month,Year and Time, respectively.
>
> Could someone please advice me on this mater?
>
Use xts.
Specify a POSIXlt index
All of the properties will be available in POSIXlt.
However, you didn't state what you wish to accomplish. It is likely
that xts will be able to subset anything you need without splitting
things up.
Realize that using a real time series class will always perform better
than using a data frame.
Cross-posting is considered rude. If you need more help than the above,
please make your query specific to some problem in finance, to keep the
list focused on its topic (finance), or only reply to r-help.
It would be polite to sign your name too...
Regards,
- Brian
--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock
More information about the R-SIG-Finance
mailing list