[Adding R-help back, as you did later.] On Wed, 7 Nov 2007, Charilaos Skiadas wrote:
> On Nov 7, 2007, at 2:51 AM, Prof Brian Ripley wrote: > >> On Tue, 6 Nov 2007, Charilaos Skiadas wrote: >> >>> Hello all, >>> >>> I ran into the following, to me unexpected, behavior. I have (for >>> reasons that don't necessarily pertain to the question at hand, hence >>> I won't go into them) the need/desire to use an empty string for the >>> name of a vector entry. >> >> The 'R Languge Definition' says >> >> The string "" is treated specially: it indicates `no name' and matches >> no element (not even those without a name). >> >> and from ?names >> >> The name \code{""} is special: it is used to indicate that there is no >> name associated with an element of a (atomic or generic) vector. >> Subscripting by \code{""} will match nothing (not even elements which >> have no name). >> >> so it should perhaps have been expected. > > It should indeed, if I had looked at ?names, which I should have thought of > doing. I wonder why ?"[" doesn't mention it though, especially the part > about: "Subscripting by "" will match nothing (not even elements which have > no name)." Well, the help page of `[` is complex enough already, there was a link to the page for names, and this doesn't seem to have bitten many people. However, I have already added the information for the next version since there were other facts about character indexing that were not there and I created a new section for them. However we try to organize it, information overload seems to be a problem for that help page. I suspect that not everyone who has worked on the code/documentation was aware of the special status of "" .... > What are the reasons for treating "" in a special way, btw? i.e. can't we use > NA to indicate "no name"? (Hm, come to think of it, NA means more that we > don't know the name, not that there isn't a name. So perhaps it makes sense > after all.) It long predates the availability of character NAs (which S did not have), and as you say, it is not quite the same. [...] -- Brian D. Ripley, [EMAIL PROTECTED] 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 ______________________________________________ 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.