Duncan Murdoch <murdoch.dun...@gmail.com> 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? > > Because sapply(example,[,1) would not be syntactically valid. And, luckily enough, sapply uses the match.fun machinery to allow string names for functions. This is also useful to ensure late binding of functions in other contexts. Johann ______________________________________________ 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.