当分配给 r 中的公式时,句号有什么作用?在lm的参数中

What does the full stop do when assigned to a formula in r? In the parameter of lm

我是一名 C# 开发人员,刚接触 R,正在尝试理解代码行

fit <- lm(quality ~ .,wine)

我知道这会创建一个名为 fit 的列表

质量~.

必须以某种方式实例化 class“公式”的对象,以便在 lm 函数中使用。

从打字开始

help("~") 

进入 R Studio 控制台,我看到了

Tilde is used to separate the left- and right-hand sides in a model formula.
Usage y ~ model
Arguments y, model symbolic expressions.
Details The left-hand side is optional, and one-sided formulae are used in some contexts.

A formula has mode call. It can be subsetted by [[: the components are ~, the left-hand side (if present) and the right-hand side in that order.

但我不知道模型公式中的左右两边是什么。

以下是什么意思?

quality ~ .

是什么意思

the left and right hand sides

模型公式?

由于这与formula有关,我们可以查看?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’.