I think you will find that this follows the partial
matching rules:

* exact match
* unique partial match
* take evasive action if non-unique partial match

Patrick Burns
[EMAIL PROTECTED]
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of S Poetry and "A Guide for the Unwilling S User")

B Fox wrote:
This seems odd.  When I try to look up a list element which has a space in
the name using just the first word (i.e. no spaces), it will sometimes
return the element with a space in the name and sometimes it will return
NULL.

Try this:

alist <- list( 'hello'=10, bye=20, 'hello world'=30, 'goodbye world'=40, 'hi
world'=50, 'goodbye foo'=60, 'goodbye bar'=70)
Then try fetching some list elements:
alist[['goodbye']]
NULL
alist[['hi']]
[1] 50
alist[['hello']]
[1] 10
With "goodbye" there were a couple list elements with spaces in the name, so
it didn't return any of them.

With "hi" there was one (and only one) element which had "hi" as the first
word: "hi world"

With "hello" there was an actual element named "hello"

This seems messed up and non-intuitive to say the least.

I am doing this on R version 2.5.0 (2007-04-23) compiled on a itanium64
and I also tried it on R version 2.5.1 (2007-06-27) on an pentium 4 ubuntu
linux

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