Message-ID: <49858B2B.1040500@biostat.ku.dk>
Date: 2009-02-01T11:44:43Z
From: Peter Dalgaard
Subject: sub question
In-Reply-To: <971536df0901311507w7201104ajb07cd9f281eb967d@mail.gmail.com>
Gabor Grothendieck wrote:
> On Sat, Jan 31, 2009 at 6:01 PM, Wacek Kusnierczyk
th some additional boring pedantry wrt. ?gsubfn, which says:
>>
>> " If 'replacement' is a formula instead of a function then a one
>> line function is created whose body is the right hand side of the
>> formula and whose arguments are the left hand side separated by
>> '+' signs (or any other valid operator). The environment of the
>> function is the environment of the formula. If the arguments are
>> omitted then the free variables found on the right hand side are
>> used in the order encountered. "
>>
>> to my little mind, all of 'paste', 'rep', 'nchar', and 'x' in the
>> example above are *free variables* on the right of the formula. you
>
> The first three are functions, not variables.
They are still free variables, subject to the same rules of variable
lookup. Wacek is right: The RHS is scanned recursively for objects of
mode "name" _except_ when they appear as function names (i.e. if
subexpression e is mode "call", then forget e[[1]] and look at the
arguments in as.list(e)[-1]. Not sure if this also happens if e[[1]] is
not a name, e.g. in f(a)(b), do you get both a and b or just b?)
He is also right that it is pedantry...
--
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907