Re: [R] issue with nzchar() ?

2012-08-07 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 5:27 PM, R. Michael Weylandt wrote: > On Mon, Aug 6, 2012 at 9:53 AM, Liviu Andronic wrote: >> On Mon, Aug 6, 2012 at 4:48 PM, Liviu Andronic >> wrote: >>> string, something that I find strange. At best NA is the equivalent of >>> an empty string. > > Certainly not to my

Re: [R] issue with nzchar() ?

2012-08-06 Thread David L Carlson
elp-bounces@r- > project.org] On Behalf Of Bert Gunter > Sent: Monday, August 06, 2012 10:43 AM > To: Liviu Andronic > Cc: r-help@r-project.org Help > Subject: Re: [R] issue with nzchar() ? > > Liviu: > > Well, as usual, to a certain extent this is arbitrary and the only >

Re: [R] issue with nzchar() ?

2012-08-06 Thread Bert Gunter
Liviu: Well, as usual, to a certain extent this is arbitrary and the only issue is whether it is documented correctly. To me, NA (of whatever mode) means ""indeterminate" or "unknown," so since "" is known and of length 0, I would have expected NA as a return. But the point is, not what our parti

Re: [R] issue with nzchar() ?

2012-08-06 Thread R. Michael Weylandt
On Mon, Aug 6, 2012 at 9:53 AM, Liviu Andronic wrote: > On Mon, Aug 6, 2012 at 4:48 PM, Liviu Andronic wrote: >> string, something that I find strange. At best NA is the equivalent of >> an empty string. Certainly not to my mind, unless you think that zero and NA should be the same for integers

Re: [R] issue with nzchar() ?

2012-08-06 Thread Liviu Andronic
On Mon, Aug 6, 2012 at 4:48 PM, Liviu Andronic wrote: > string, something that I find strange. At best NA is the equivalent of > an empty string. In this sense, if you Hmisc::describe() the vector > you get, as I would expect, that in the context of character vectors > NA and '' values are conside

[R] issue with nzchar() ?

2012-08-06 Thread Liviu Andronic
Dear all I'm a bit surprised by the results output from nzchar(). The help page says: "nzchar is a fast way to find out if elements of a character vector are *non-empty strings*." (my emphasis. However, if you do > x <- c(letters, NA, '') > nzchar(x) [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE