Meaning of dot in lm(y~.) in R

Viewed 9764

I am trying to understand the meaning of this statement in R in a code written by somebody else.

mymodel = lm(gene ~ ., data = mydata) 

mydata is as follows:

> mydata
                 gene    cna rs11433683      PC1    PC2
TCGA.BH.A0C0 270.7446 0.1291          0 270.7446 0.1291
TCGA.A2.A3XY  87.9092 0.0128          1  87.9092 0.0128
TCGA.XX.A89A 255.1346 0.1530          1 255.1346 0.1530

I have gone through the R help section to find how . is interpreted. I understand that . is typically not used, but this is what I found

help(formula)

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’

help(terms.formula)

AllowDotAsName: normally . in a formula refers to the remaining variables contained in data. Exceptionally, . can be treated as a name for non-standard uses of formulae.

data: a data frame from which the meaning of the special symbol . can be inferred. It is unused if there is no . in the formula.

However, I am not really sure what the statements mean. Can somebody give me a simple example of what it means in the context of statement and data I mentioned above?

2 Answers
Related