Displaying 3 results from an estimated 3 matches for "iss4object".
Did you mean:
isobject
2004 Nov 26
1
Testing for S4 objects
Dear r-help list members,
Is there a way to test whether an object is an S4 object? The best that I've
been able to come up with is
isS4object <- function(object) !(is.null(slotNames(object)))
which assumes that an S4 object has at least one slot. I think this is safe,
but perhaps I'm missing something.
Thanks,
John
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8...
2004 Nov 26
1
Testing for S4 objects
Dear r-help list members,
Is there a way to test whether an object is an S4 object? The best that I've
been able to come up with is
isS4object <- function(object) !(is.null(slotNames(object)))
which assumes that an S4 object has at least one slot. I think this is safe,
but perhaps I'm missing something.
Thanks,
John
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8...
2006 Feb 20
0
changes in r-devel for S3/S4 objects
...ass. See the setOldClass help page.)
2. There is a heuristic test for S4 objects, seemsS4Object(), and a
corresponding C-level test, R_seemsS4Object(object), both using the
existence of a "package" attribute on class(object) as a test.
The test is called seemsS4Object() rather than isS4Object()
deliberately, but it should be fairly accurate.
It will mistakenly identify an S3 object as S4 if the package attribute
is there (possible, but hard to see why anyone would do this).
It can make the opposite mistake, though, UNLESS the package generating
the object is reinstalled with the cur...