RE: Re: subset

Jens Oehlschlaegel (oehl@Psyres-Stuttgart.DE)
Mon, 12 Jan 1998 20:20:33 +0100 (MET)


# Happy new year to all of you #

On Tue, 23 Dec 1997, JOHN THADEN wrote:

> A related question: Instead of calling this function
> df.subset(), why not call it subset.data.frame() and
> let it be a method function for a generic function
> subset()? The generic function would then be:
>
> subset <- function(df, ...) UseMethod("subset")
>
> This would seem to be more in the Splus style. When
> I first saw "df.subset()", I was sure it had some-
> thing to do with degrees of freedom!

In general one could do so,
however in this case your suggestion could produce a little confusion,
df.subset() was an altered version of subset(), with the difference that
df.subset() re-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 ?

Best regards

Jens

--
Jens Oehlschlaegel-Akiyoshi
Psychologist/Statistician
Project TR-EAT + COST Action B6
                                                 F.rankfurt
oehl@psyres-stuttgart.de                         A.ttention
+49 711 6781-408 (phone)                         I.nventory
+49 711 6876902  (fax)                           R .-----.
                                                  / ----- \
Center for Psychotherapy Research                | | 0 0 | |
Christian-Belser-Strasse 79a                     | |  ?  | |
D-70597 Stuttgart Germany                         \ ----- /
-------------------------------------------------- '-----' -
(general disclaimer)                             it's better