Skip to content
Prev 34030 / 63424 Next

S3 objects in S4 slots

2009/9/15 John Chambers <jmc at r-project.org>:
That would be really useful.

Do you think it would be feasible to automatically assume that all S3
objects "contain" their basic data type (like a list, in this case)
for purposes of S4 class matching, when no other information is given?

At least in this specific case, the idea is that corpus objects can be
used as a list of character vectors and code does not need to know
anything about the object structure as long as only the contents of
the list are needed. So (again, in this specific case), I would
consider "defaulting" to the underlying data type optimal.
Thanks to Martin Morgan for the workaround, it works very well.