Re: [R] Using '[' as a function

2010-08-04 Thread peter dalgaard
On Aug 3, 2010, at 7:59 PM, Johann Hibschman wrote: > Duncan Murdoch writes: >> On 29/07/2010 6:18 PM, chipmaney wrote: >>> >>> -Why does R recognize '[' as a function? >> >> Because it is a function. > > More explicitly, '[' is a string. sapply then calls match.fun to look > up that strin

Re: [R] Using '[' as a function

2010-08-03 Thread Wu Gong
I have just learned from the R Language Definiation ##Operators are special functions # Examples "<-"(x,1:6) "["(x,3) "+"(3,5) '-'(3,6) '/'(3,6) '*'(3,6) - A R learner. -- View this message in context: http://r.789695.n4.nabble.com/Using-as-a-function-tp2307292p2312424.html Sent from the R

Re: [R] Using '[' as a function

2010-08-03 Thread Johann Hibschman
Duncan Murdoch writes: > On 29/07/2010 6:18 PM, chipmaney wrote: >> >> -Why does R recognize '[' as a function? > > Because it is a function. More explicitly, '[' is a string. sapply then calls match.fun to look up that string to get the function named '['. >> -Why does it need the quotes? >

Re: [R] Using '[' as a function

2010-07-29 Thread Duncan Murdoch
On 29/07/2010 6:18 PM, chipmaney wrote: I am learning R, and instead of learning by rote, I am trying to better understand the language in order to improve my programming. So any "meta-information" on why the following code works would be greatly appreciated... I obtained this code to extract th

[R] Using '[' as a function

2010-07-29 Thread chipmaney
I am learning R, and instead of learning by rote, I am trying to better understand the language in order to improve my programming. So any "meta-information" on why the following code works would be greatly appreciated... I obtained this code to extract the first record from each of a series of v