Re: [R] About name of list elements

2013-03-26 Thread Rolf Turner
On 03/26/2013 12:52 PM, Peter Ehlers wrote: Sooner or later most R beginners are bitten by this all too convenient shortcut. [I.e. the use of $-extraction] As an R newbie, think of R as your bank account: overuse of $-extraction can lead to undesirable consequences. It's best to acquire

Re: [R] About name of list elements

2013-03-25 Thread Peter Ehlers
To the OP: Sooner or later most R beginners are bitten by this all too convenient shortcut. As an R newbie, think of R as your bank account: overuse of $-extraction can lead to undesirable consequences. It's best to acquire the '[[' and '[' habit early. Peter Ehlers On 2013-03-25 12:43, Bert G

Re: [R] About name of list elements

2013-03-25 Thread Bert Gunter
Hello Starter Before posting, please read relevant Help files! ?"$" where it tells you: "x$name is equivalent to x[["name", exact = FALSE]]. Also, the partial matching behavior of [[ can be controlled using the exact argument." ..etc. -- Bert On Mon, Mar 25, 2013 at 12:21 PM, Andrew Lin wr

Re: [R] About name of list elements

2013-03-25 Thread Sarah Goslee
If you use the shortcut $ then R will use partial matching to hunt for the list element you mean. l$fo will also match. l[["foo"]] will not match - the full subsetting construct doesn't use partial matching. I think the intro to R covers this, and you can also see ?"$" ?"[[" Sarah On Monday, Ma

Re: [R] About name of list elements

2013-03-25 Thread Joshua Wiley
Hi Max, This is known as fuzzy matching. When using `$`, if R can uniquely match the element name based on what is typed, it returns it. Thus, in your example, foo uniquely matches foobar, but if you had foobar, foobox, $foo would not be a unique match. Cheers, Josh On Mon, Mar 25, 2013 at 1

[R] About name of list elements

2013-03-25 Thread Andrew Lin
Hi folks, I am starter for R. While I tried list as following: > l <- list() > l$foo NULL > l$foobar <- 1 > l$foo [1] 1 Apparently, foo and foobar are different name for elements in list (actually foo does not exist). But why they are sharing same value? Thanks a lot! Max [[alternativ