与 ~(在公式中)一起使用时,句点是什么意思? [英] What does the period mean when used with ~ (in a formula)?
问题描述
来自 FSelector 手册:
data(iris)
subset <- cfs(Species~., iris)
f <- as.simple.formula(subset, "Species")
print(f)
具体来说,我指的是物种~"中的那个.
Specifically, I mean the one in "Species~.".
现在,Google 很难使用标点符号(无论如何对我来说),而我什么也做不了.这段代码不清楚.
Now, it's awfully tough to Google how a bit of punctuation is used (for me anyway) and I couldn't anything. This code is unclear.
推荐答案
我认为您指的是 Species~.
中包含的句点,在这种情况下,这只是标准的 R 公式引用数据框中的所有其他变量",而不是像Species ~ Variable1 + Variable2
等中那样将它们一个一个地键入.
I think you're referring to the period contained in Species~.
, in which case this is just the standard R formulation of referring to 'all other variables' in the data frame, rather than typing them out one by one, as in Species ~ Variable1 + Variable2
etc.
来自?formula
的帮助文件:
有两种特殊的解释.在一个公式中.平时的在模型拟合函数的数据参数的上下文中,并且表示不在公式中的所有列":请参阅terms.formula.在 update.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’.
这篇关于与 ~(在公式中)一起使用时,句点是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!