[R] [R-SIG-Finance] How to separate date and time into different columns?
J Ryan
jeff.a.ryan at gmail.com
Fri Jan 22 20:13:35 CET 2010
A note about xts:
The time class layer is abstracted from the implementation. This
allows for some very time specific manipulation without having to
manage the underlying details.
Take a look at the xts docs and vignette.
Also, the functions .indexmon .indexyear etc correspond to the POSIXlt
components. The xts object doesn't use this as a class, but this
allows you access as if it did.
HTH
Jeff
Jeffrey A. Ryan
jeffrey.ryan at insightalgo.com
ia: insight algorithmics
www.insightalgo.com
On Jan 22, 2010, at 12:18 PM, "Brian G. Peterson"
<brian at braverock.com> wrote:
> 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
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R
> questions should go.
More information about the R-help
mailing list