[19033] in s-news-athena
Re: [S] Summary: Adding levels to a factor
daemon@ATHENA.MIT.EDU (Z. Todd Taylor)
Tue Aug 24 14:26:01 1999
Date: Tue, 24 Aug 1999 11:19:57 -0700 (PDT)
From: "Z. Todd Taylor" <Todd.Taylor@pnl.gov>
To: s-news@wubios.wustl.edu
Cc: todd.taylor@pnl.gov
Message-Id: <199908241819.LAA00904@aggie.pnl.gov>
Prof Brian D Ripley <ripley@stats.ox.ac.uk> wrote:
>
> Rather than re-invent the wheel, one could note that na.tree.replace
> adjust all the factors in a data frame to have level "NA" if needed.
> Its code does not convert to character and back. However, you could
> just use it!
>
Hmm. na.tree.replace seems to expect a data frame, not an
individual factor. Are you suggesting to modify that or pull
out the relevant parts? Looking inside, the important
expression appears to be:
x <- factor(x, c(1:4, "NA"), c(levels(xx), "NA"), exclude = NULL)
Beware that 1:4 hard-coded limit.
Also, na.tree.replace seems to have been replaced by
na.tree.replace.all in Splus 5.*.
--Todd
--
Z. Todd Taylor
Pacific Northwest National Laboratory
Todd.Taylor@pnl.gov
Why do raise and raze sound the same?
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news