[Rd] nchar( NA )

Hadley Wickham hadley at rice.edu
Sat Jun 19 03:56:00 CEST 2010


> Value:
>
>     For ‘nchar’, an integer vector giving the sizes of each element,
>     currently always ‘2’ for missing values (for ‘NA’).
>
> It may be unexpected behavior, but it's *well-documented* unexpected behavior.

Oh, that must make it ok then.

For a more sensible take:

> library(stringr)
> str_length(c("", NA))
[1]  0 NA


Hadley


-- 
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/



More information about the R-devel mailing list