I read a R code on loess regression, here is part of it:
f.lo<- loess(bgs ~ f[,1], span=bw, degree=1)
bsln <- f.lo$fitted
What are their functions: bgs~f[,1]
, the ~
and the $
in the next line? thanks
I read a R code on loess regression, here is part of it:
f.lo<- loess(bgs ~ f[,1], span=bw, degree=1)
bsln <- f.lo$fitted
What are their functions: bgs~f[,1]
, the ~
and the $
in the next line? thanks
mbq's answer is correct, but I'll just add this:
> `~`(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>
>