From hadley at rice.edu  Sat Jun 19 03:56:00 2010
From: hadley at rice.edu (Hadley Wickham)
Date: Fri, 18 Jun 2010 18:56:00 -0700
Subject: [Rd] nchar( NA )
In-Reply-To: <AANLkTimV5wJTILsifdwPUv7ROY-WY9buNLE937IuqVAa@mail.gmail.com>
References: <4C1BDC89.50003@r-enthusiasts.com>
	<AANLkTimV5wJTILsifdwPUv7ROY-WY9buNLE937IuqVAa@mail.gmail.com>
Message-ID: <AANLkTinB_ze518SW92t8xA8hnRbB32pixi5PrdbxeyRv@mail.gmail.com>

> 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/



[Rd] nchar( NA )
Hadley Wickham