[R-SIG-Finance] nonstandard date time format?

Spencer Graves spencer.graves at pdf.com
Sun Nov 11 00:04:41 CET 2007


Hi, Gabor: 

      Thanks very much.  I've seen the R News and zoo vignettes before 
but forgot.  Thanks again for the reminder

      Spencer

Gabor Grothendieck wrote:
> The first will require at least a minimum of processing but
> the others can be done directly to create variables of chron class
> c("dates", "times"), zoo class "yearmon" and class "Date"
> respectively.  From those its easy to convert to other
> classes:
>
>   
>> library(chron)
>> chron(" 40100    103.0900", format = "dmy")
>>     
> [1] 040100
>
>   
>> library(zoo)
>> as.yearmon("1947 10    254.4", "%Y %m")
>>     
> [1] "Oct 1947"
>
>   
>> as.Date("1948 01 01   3.4", "%Y %m %d")
>>     
> [1] "1948-01-01"
>
> There is an article on dates in R News 4/1 with a helpful
> table at the end.  zoo comes with two vignettes.
>
>
> On Nov 10, 2007 1:23 PM, Spencer Graves <spencer.graves at pdf.com> wrote:
>   
>> Hi, All:
>>
>>      What functions exist for processing dates and times beyond, e.g.,
>> strptime?  I can process the following examples using substr, paste,
>> strptime, etc., but I wonder if more elegant ways exist:
>>
>>      * "    90110134228     18800    105.3750    105.5000    105.3750"
>> records 4 numbers collected at 34228 seconds (9:30:28 AM) into 1
>> November 1990.
>>
>>      * " 40100    103.0900" is interpreted as a quantity of 103.9 on 4
>> January 2000.
>>
>>      * "1947 10    254.4" is 254.4 for October 1947.
>>
>>      * "1948 01 01   3.4" is 3.4 for 1 Jan. 1948
>>
>>      This is part of a soon-to-be released "FinTS" package companion to
>> Ruey Tsay (2005) Analysis of Financial Time Series (Wiley).  Since this
>> is a teaching tool, I'd like to use the best approach available.
>> Otherwise, I'd just code something and move on to the next task.
>>
>>      Thanks,
>>      Spencer Graves
>> p.s.  Anyone interested in this can obtain the current pre-release
>> version via
>> install.packages("FinTS",repos="http://r-forge.r-project.org").
>>
>> _______________________________________________
>> 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.
>>
>>



More information about the R-SIG-Finance mailing list