s-news
[Top] [All Lists]

FW: Finding which method is used by a function

To: <s-news@wubios.wustl.edu>
Subject: FW: Finding which method is used by a function
From: "Cahill, Shane" <Shane.Cahill@ILIM.COM>
Date: Tue, 19 Aug 2008 14:12:22 +0100
Thread-index: Acj+G0dPt0eitF2wSZO0QUogQGuzEAD4InBQ
Thread-topic: Finding which method is used by a function

Thanks to Chris Green and Chuck Taylor for responding to my question.  Their answers are posted below.

Shane



Shane,
The timeSeries class is a version 4 class, so its methods are probably not stored in an explicit function. Try using getMethods to see what version 4 classes methods are out there:

 
> getMethods("summary")
 
I think timeSeries inherits from seriesVirtual (don't quote me on that), so the method for signature "seriesVirtual" is the one you want.

 
HTH,
Chris Green
 
________________________________

Christopher G. Green (cggreen AT stat.washington.edu)
Doctoral Candidate
Department of Statistics, Box 354322, Seattle, WA, 98195-4322, U.S.A.
http://www.stat.washington.edu/cggreen/



Shane,
The “timeSeries” class is an S Version 4 class, so method dispatch is different from what you are used to. First, let’s look at what SV4 methods there are for “summary”:

> showMethods("summary")
      Database            object
 [1,] "splus"  "ANY"
 [2,] "splus"  "groupVecVirtual"
 [3,] "splus"  "numericSequence"
 [4,] "splus"  "timeZoneC"
 [5,] "splus"  "timeZoneS"
 [6,] "splus"  "timeDate"
 [7,] "splus"  "timeSpan"
 [8,] "splus"  "seriesVirtual"
 [9,] "splus"  "timeEvent"
[10,] "splus"  "timeRelative"
[11,] "splus"  "timeSequence"

The “timeSeries” class doesn’t appear there, so let’s see whether timeSeries inherits from one of the classes that does appear:

> extends("timeSeries")
[1] "timeSeries"    "series"        "seriesVirtual"

We see that “timeSeries” inherits from “seriesVirtual”, so it is the “seriesVirtual” method of summary that gets dispatched. To see what that method looks like, you can run

     showMethod("summary", "seriesVirtual")

To confirm that you have the right method, look at the output of

     selectMethod(“summary”, “timeSeries”)

Best regards,

Chuck Taylor
Insightful Corporation
Seattle, WA, USA

______________________________________________
From:   Cahill, Shane 
Sent:   14 August 2008 15:37
To:     's-news@wubios.wustl.edu'
Subject:        Finding which method is used by a function

Hi,
I would like to find out which method for the function 'summary' is used on a timeSeries object.
There does not appear to be an explicit 'summary.timeSeries' method and 'summary.default' does not return the same output as 'summary'.

I use S-PLUS 8.0 for Windows.

Kind regards,
Shane

**********************************************************************************

Irish Life Investment Managers Limited is authorised by the Financial Regulator. Irish Life Investment Managers Limited Registered Office: Beresford Court, Beresford Place, Dublin 1. Registered in Ireland Number 116000

 

While Irish Life Investment Managers uses reasonable efforts to ensure that the information contained in this email is current, accurate and complete at the date of publication, no representations or warranties are made (express or implied) as to the reliability, accuracy or completeness of such information. Irish Life Investment Managers therefore cannot be held liable for any loss arising directly or indirectly from the use of, or any action taken in reliance on, any information contained in this email.

 

This material is for information only and does not constitute an offer or recommendation to buy or sell any investment, or subscribe to any investment management or advisory service. It is intended for the use of institutional and other professional investors. Past performance is not indicative of future results. The value of funds we manage may fall as well as rise.

 

This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept for the presence of computer viruses.

**********************************************************************************

 

<Prev in Thread] Current Thread [Next in Thread>