[R] Creating NA equivalent

Adrian Dușa du@@@@dr|@n @end|ng |rom gm@||@com
Sun Dec 26 22:54:20 CET 2021

Responding a bit slow during holidays.
Indeed, following Ducan Murdoch's advice I created the package declared
which has a simple mechanism of attributing different interpretations for
the same NA value, within a vector.

I learned there is no need for different NA values, the built in NA is
enough. By allocating different interpretations (labels), the end result is
similar as if we had different NA values, all in base R.

This meta-information can subsequently be used for any conceivable purpose,
including what I read in this thread about censoring etc.

I hope this helps, best wishes and season's greetings,

On Tue, 21 Dec 2021 at 21:45, Avi Gross <avigross using verizon.net> wrote:

> I wonder if the package Adrian Dușa created might be helpful or point you
> along the way.
> It was eventually named "declared"
> https://cran.r-project.org/web/packages/declared/index.html
> With a vignette here:
> https://cran.r-project.org/web/packages/declared/vignettes/declared.pdf
> I do not know if it would easily satisfy your needs but it may be a step
> along the way. A package called Haven was part of the motivation and Adrian
> wanted a way to import data from external sources that had more than one
> category of NA that sounds a bit like what you want. His functions should
> allow the creation of such data within R, as well. I am including him in
> this email if you want to contact him or he has something to say.
> -----Original Message-----
> From: R-help <r-help-bounces using r-project.org> On Behalf Of Duncan Murdoch
> Sent: Tuesday, December 21, 2021 5:26 AM
> To: Marc Girondot <marc_grt using yahoo.fr>; r-help using r-project.org
> Subject: Re: [R] Creating NA equivalent
> On 20/12/2021 11:41 p.m., Marc Girondot via R-help wrote:
> > Dear members,
> >
> > I work about dosage and some values are bellow the detection limit. I
> > would like create new "numbers" like LDL (to represent lower than
> > detection limit) and UDL (upper the detection limit) that behave like
> > NA, with the possibility to test them using for example is.LDL() or
> > is.UDL().
> >
> > Note that NA is not the same than LDL or UDL: NA represent missing data.
> > Here the data is available as LDL or UDL.
> >
> > NA is built in R language very deep... any option to create new
> > version of NA-equivalent ?
> >
> There was a discussion of this back in May.  Here's a link to one approach
> that I suggested:
>    https://stat.ethz.ch/pipermail/r-devel/2021-May/080776.html
> Read the followup messages, I made at least one suggested improvement.
> I don't know if anyone has packaged this, but there's a later version of
> the code here:
>    https://stackoverflow.com/a/69179441/2554330
> Duncan Murdoch
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]

More information about the R-help mailing list