Re: subset

Jens Oehlschlaegel (oehl@Psyres-Stuttgart.DE)
Mon, 19 Jan 1998 10:57:29 +0100 (MET)


On Tue, 13 Jan 1998, JOHN THADEN wrote:

> 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?

I would like to keep the old subset() for efficiency, look at the
following:

> dim(basic)
[1] 1247 247
> dos.time(names(subset(basic,PAT==100)))
[1] 2.420006
> dos.time(names(df.subset(basic,PAT==100)))
[1] 19.06

Factor 8 is quite a difference

Also it can be an advantage, if factors are *not* automatically changed,
e.g. if you want to tabulate empty categories also, or to get a warning on
empty categories rather than smoothly running an analysis you don't
really want.

Best regards

--
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