2010-08-28 113 views
2

我读了黄土回归A R代码,这里是其中的一部分:这些是什么R的含义指出

f.lo<- loess(bgs ~ f[,1], span=bw, degree=1) 
bsln <- f.lo$fitted 

他们有什么功能:bgs~f[,1],在~并在下一行$?感谢

回答

2

代字号~创建一个公式,$提取从S3对象由loess创建的fitted元件(这样的事实上的列表)。你可以在R-intro找到更多的细节。

0

活度的答案是正确的,但我只补充一点:

> `~`(y, x) 
y ~ x 
> class(`~`(y, x)) 
[1] "formula" 
> terms(`~`(y, x)) 
y ~ x 
attr(,"variables") 
list(y, x) 
attr(,"factors") 
    x 
y 0 
x 1 
attr(,"term.labels") 
[1] "x" 
attr(,"order") 
[1] 1 
attr(,"intercept") 
[1] 1 
attr(,"response") 
[1] 1 
attr(,".Environment") 
<environment: R_GlobalEnv> 
>