[Rd] implementation of NULL in vectors

Prof Brian Ripley ripley at stats.ox.ac.uk
Sun Jan 4 07:19:15 CET 2009


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



More information about the R-devel mailing list