[R] drop rare factors

Sarah Goslee sarah.goslee at gmail.com
Thu Jan 19 22:18:30 CET 2012


On Thu, Jan 19, 2012 at 4:11 PM, William Dunlap <wdunlap at tibco.com> wrote:
>> That's the only thing I see, *except* that df() and drop() are base functions,
>> so you shouldn't use those as variable names.
>
> I don't think that is much of a problem.  The local
> versions will be used in the function.

Yes, but somewhere in the series of emails the original querent was talking
about running the function line by line to see if each bit worked, a common
debugging method. It's generally safer to not use base functions as
names (see the many questions to the list due to using c as a name).
(Or actually, I'm not entirely certain that's what he meant, but that's how
interpreted one of the vague statements.)

> A bigger problem is naming your function 'drop.levels'.
> There is a core R function called 'droplevels' that drops
> unused levels from factors.  I would hate to have to
> remember the difference between the dotted and dotless
> versions.

Definitely confusing if this ever gets used beyond the single
person who wrote it.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org



More information about the R-help mailing list