Re: subset

JOHN THADEN (JJTHADEN@LIFE.UAMS.EDU)
Tue, 13 Jan 1998 10:21:36 -0600 (CST)


On Dec 23, I wondered if it would not be more in the S-plus style
to define a function subset.data.frame() as an instance of a
method subset(), rather than to use df.subset() as described
in various postings to s-news. On Jan 12, Jens Oehlschlaegel-Akiyoshi
responded,

>>In general one could do so,
however in this case your suggestion could produce a little

df.subset() was an altered version of subset(), with the difference that
df.subset() r
e-adjustes factors wheras subset() doesn't affect factor
definition. So if generating a generic subset(), the "df"-part should only
be invoked via a non-default parameter.

However, a generic only makes sense, if you expect more than one method
for this generic. For which objects other than dataframes are you thinking
about needing subset ?<<

(sorry, please append the word "confusion" to line 2 of Jens' comment)

Yes, there is a function subset() upon which df.subset() builds, but in
my opinion, the latter is such an improvement over subset() that I'm
suggesting subset(), as written, is dispensible and might be converted
to a generic method. It is not, after all, a part of S-Plus (at least
not my Windows versions). Can you think of a usage appropriate for
subset() as now written where df.subset() as now written would not
also work?

Other methods for a generic subset()? I suppose a subset() function
might be useful for lists in general, for matrices and model.matrices,
certainly I would think for factors.

Best regards,

John Thaden, Biochemist
Department of Geriatrics
University of
Arkansas for Medical Sciences
Little Rock Arkansas USA