From ripley at stats.ox.ac.uk  Sun Jan  4 07:19:15 2009
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sun, 4 Jan 2009 06:19:15 +0000 (GMT)
Subject: [Rd] implementation of NULL in vectors
In-Reply-To: <c96a5b9e0901032032y648caf23u77a697ffe8fa927f@mail.gmail.com>
References: <c96a5b9e0901032032y648caf23u77a697ffe8fa927f@mail.gmail.com>
Message-ID: <alpine.LFD.2.00.0901040615500.4921@auk.stats.ox.ac.uk>

On Sat, 3 Jan 2009, Mark Rosen wrote:

> All,
>
> I was wondering if someone could point me to the location of the code in R
> that supports NULL values in vectors. I'm curious as to how you implemented
> them.

We don't allow NULL in atomic vectors. The 'R Internals' manual discusses 
such implementation issues.

>
> The only possible solution to me seems that for a double [], you need to
> keep a parallel bool [] that tells you whether the value is null or not. The
> bool [] doesn't have to be a literal bool [] -- you can keep a bit array.
> Things like summing up a vector become complicated -- you need to check if
> something is null before you perform an operation on it.
>
> For the purposes of vectors of numeric data types, why not represent NULL as
> NaN (as long as you're happy with the standard semantics of NaN)
>
> Thanks.
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] implementation of NULL in vectors
Prof Brian Ripley