Because it's a character vector with only one element, which just happens to be 
empty - sort of like why the cardinality of the set { /O } is one. (/O being my 
best shot at the empty set symbol in plain text). 

You might be thinking of nchar(). 

Michael

On Nov 18, 2011, at 10:09 AM, "Jaensch, Steffen [TIBBE]" <sjaen...@its.jnj.com> 
wrote:

> Hi all,
> 
> 
> 
> Can somebody explain why length("") returns 1 and not 0? How do I test
> if a given string is the empty string?
> 
> 
> 
> Thanks,
> 
> Steffen.
> 
> 
> 
> 
> 
> 
> 
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to