Skip to content

timeDate class query

4 messages · Ian Seow, Yohan Chalabi

#
Hi, I have a query on the timeDate class in the fCalendar Package.
I have a large data set of intraday observations (in GMT) containing
407,100 POSIXct objects which I want to convert into timeDate objects
and then view the result in my local time zone ('Asia/Singapore').
The conversion works fine, however, it seems that timeDate does not
have 'Dims' and hence does not allow for length(), head() and tail()
to be performed.
In this case, how do I go about printing say the last 6 elements in
this object? If I convert the timeDate object into another class, the
timezone conversion information is lost and I get my return object in
"GMT" which is not what I want. Appreciate any ideas on this?

Here's the code to illustrate my point:


Original Object in POSIXct
==========================
[1] "POSIXt"  "POSIXct"
[1] 407100
[1] "2008-06-02 12:30:00 Malay Peninsula Standard Time" "2008-06-02
12:35:00 Malay Peninsula Standard Time"
[3] "2008-06-02 12:40:00 Malay Peninsula Standard Time" "2008-06-02
12:45:00 Malay Peninsula Standard Time"
[5] "2008-06-02 12:50:00 Malay Peninsula Standard Time" "2008-06-02
12:55:00 Malay Peninsula Standard Time"
Converted object into timeDate class
====================================
Error in length.timeDate(myTZ) :
  no slot of name "Dim" for this object of class "timeDate"
Error in length.timeDate(x) :
  no slot of name "Dim" for this object of class "timeDate"
Converted object into character Class, but loses timezone conversion
information. Result returned is back in GMT
================================================================================================================
[1] "2008-06-02 12:30:00" "2008-06-02 12:35:00" "2008-06-02 12:40:00"
"2008-06-02 12:45:00" "2008-06-02 12:50:00" "2008-06-02 12:55:00"


Thanks!

Rgds
Ian Seow
12 days later
#
IS> Hi, I have a query on the timeDate class in the fCalendar Package.
   IS> I have a large data set of intraday observations (in GMT) containing
   IS> 407,100 POSIXct objects which I want to convert into timeDate objects
   IS> and then view the result in my local time zone ('Asia/Singapore').
   IS> The conversion works fine, however, it seems that timeDate does not
   IS> have 'Dims' and hence does not allow for length(), head() and tail()
   IS> to be performed.

Do you have the latest version of fCalendar?

length(timeCalendar()) works fine with the current version of fCalendar available at CRAN.


regards,
Yohan
#
Hi Yohan thanks for your reply. Are you referring to version 270.75
for fCalendar? This is the latest version I could find and it is the
version I am currently using. I must be missing something, because
when I try length(timeCalendar( ) ) I get the following error:
+                 y = c(1989, 2001, 2004, 1990), FinCenter = "GMT")
GMT
[1] [1989-09-28] [2001-01-15] [2004-08-30] [1990-02-09]
Error in prod(x at Dim) : no slot of name "Dim" for this object of class "timeDate"
On 7/23/08, Yohan Chalabi <chalabi at phys.ethz.ch> wrote:
#
IS> Hi Yohan thanks for your reply. Are you referring to version 270.75
   IS> for fCalendar? This is the latest version I could find and it is the
   IS> version I am currently using. I must be missing something, because
   IS> when I try length(timeCalendar( ) ) I get the following error:
   IS> 
   IS> > test=timeCalendar(m = c(9, 1, 8, 2), d = c(28, 15, 30, 9),  
   IS> +                 y = c(1989, 2001, 2004, 1990), FinCenter = "GMT")
   IS> 
   IS> > test  
   IS> GMT
   IS> [1] [1989-09-28] [2001-01-15] [2004-08-30] [1990-02-09]
   IS> 
   IS> > length(test)  
   IS> Error in prod(x at Dim) : no slot of name "Dim" for this object of class "timeDate"

timeDate class used to have a @Dim two or three versions ago. As far
as I can see, all references to @Dim have been removed.

the function length.timeDate is defined in v270.75 as :

length.timeDate <- 
    function(x) 
{   
    # A function implemented by Diethelm Wuertz

    # Description:
    #   Gets the length of a 'timeDate' vector

    # Arguments:
    #   x - a 'timeDate' object
    
    # Value:
    #   Returns the lengths of an object of class 'timeDate'.

    # FUNCTION:
    
    # Length:
    ans = length(x at Data)
    
    # Return Value:
    ans
}

as you can see there is no reference to @Dim.

Could you please show us how your length.timeDate looks like.

regards,
Yohan