【发布时间】:2014-02-06 08:55:56
【问题描述】:
我有一个公式对象并试图访问公式,我找到了函数term:
R) terms(myFormula)
z ~ 0 + I(x/v) + y + I(w/v)
attr(,"variables")
list(z, I(x/v), y, I(w/v))
attr(,"factors")
I(x/v) y I(w/v)
z 0 0 0
I(x/v) 1 0 0
y 0 1 0
I(w/v) 0 0 1
attr(,"term.labels")
[1] "I(x/v)" "y" "I(w/v)"
attr(,"order")
[1] 1 1 1
attr(,"intercept")
[1] 0
attr(,"response")
[1] 1
attr(,".Environment")
<environment: 0x2f90dee0>
我怎样才能直接访问所有这些数据,比如'factors' 或显示良好的z ~ 0 + I(x/v) + y + I(w/v)(我的意思是不一直使用粘贴)。
另外,我应该使用哪些函数来处理公式?
【问题讨论】: