[英]Error in eval(predvars, data, env): object 'V1' not found
I'm trying to use the linear regression's tools:我正在尝试使用线性回归的工具:
data=read.table("http://users.stat.ufl.edu/~winner/data/pgalpga2008.dat", check.names=FALSE)
Then I have to select only female golfers so I did:然后我必须 select 只有女性高尔夫球手所以我做了:
datF <- subset(data, V3==1, select=1:2)
Where V3 is the label of the third column.其中V3是第三列的label。 Now I should apply the linear regression method so I did:现在我应该应用线性回归方法,所以我做了:
datF.lm=lm(V1~V2)
Where V1 and V2 are the label of the other two column but I came through this error and I can't understand why.其中 V1 和 V2 是另外两列的 label 但我遇到了这个错误,我不明白为什么。
Yes, as slava-kohut states, the lm()
function requires a reference to the dataframe as one of its arguments.是的,正如 slava-kohut 所说, lm()
function 需要引用 dataframe 作为其 arguments 之一。 If you don't specify data = datF
, lm()
doesn't know where to look for the variables V1 and V2.如果您不指定data = datF
,则lm()
不知道在哪里查找变量 V1 和 V2。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.