[R] What is the . in formula ~. syntax?

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Nov 23 09:41:42 CET 2012


On 23/11/2012 08:16, Brian Feeny wrote:
>
> Thank you!  I searched in the manual, but I did not see where this is mentioned, I looked under operators
> and in some of the formula documentation.

It *is* documented on the help page for formula (and it is not an 
operator, so should not be in the documentation for operators):

      There are two special interpretations of ‘.’ in a formula.  The
      usual one is in the context of a ‘data’ argument of model fitting
      functions and means ‘all columns not otherwise in the formula’:
      see ‘terms.formula’.  In the context of ‘update.formula’, *only*,
      it means ‘what was previously in this part of the formula’.

In other contexts it is literally '.' (see ?terms.formula).

>
> Brian
>
> On Nov 23, 2012, at 3:15 AM, Michael Weylandt <michael.weylandt at gmail.com> wrote:
>
>>
>>
>> On Nov 23, 2012, at 4:26 AM, Brian Feeny <bfeeny at mac.com> wrote:
>>
>>> I know if I have a dataframe with columns y, x1, x2 and I wish to have y as my y value and x1 and x2 as x values I can do:
>>> y ~ x1 + x2
>>>
>>> or
>>>
>>> y ~.
>>>
>>> but can someone explain what . actually is or what its transposed into?
>>
>> Everything not already stated.
>>
>> rmw
>>
>>>
>>> I searched for this with no success, reading the "formula" manual pages.
>>>
>>> Brian
>>>
>>> ______________________________________________
>>> R-help at 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 at 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.
>


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list