On 03/04/2012 12:42 PM, phillen wrote:
Figured it out.

given that object 'cit' is of class S4, extracting information works as
follows:

1)finding out names of slots in object 'cit'

>  slotNames(cit)
  [1] "x"         "Z0"        "Z1"        "ZK"        "type"      "model"
  [7] "ecdet"     "lag"       "P"         "season"    "dumvar"    "cval"
[13] "teststat"  "lambda"    "Vorg"      "V"         "W"         "PI"
[19] "DELTA"     "GAMMA"     "R0"        "RK"        "bp"        "spec"
[25] "call"      "test.name"

2) extracting info from wanted slot
>  cit@teststat
[1]  5.348440  9.068113 10.643293

That's one way.  There may be another:  if you print the class of cit using

class(cit)

there may be a help page, which you would find using

class?foo

assuming "foo" is the name of the class. The author may have defined a method to get what you want, or may give other guidance. For example, in the Matrix package:

> x <- Hilbert(6)
> class(x)
[1] "dpoMatrix"
attr(,"package")
[1] "Matrix"
> class?dpoMatrix

gives quite useful information about the dpoMatrix class.

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to