Linear model function lm() error: NA/NaN/Inf in foreign function call (arg 1)

后端 未结 10 1206
天涯浪人
天涯浪人 2020-12-03 09:49

Say I have data.frame a

I use

m.fit <- lm(col2 ~ col3 * col4, na.action = na.exclude)

col2 has some <

10条回答
  •  时光说笑
    2020-12-03 10:46

    I just encountered the same problem. get the finite elements using

    finiteElements = which(is.finite(col3*col4))
    finiteData = data[finiteElements,]
    lm(col2~col3*col4,na.action=na.exclude,data=finiteData)
    

提交回复
热议问题