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

后端 未结 10 1187
天涯浪人
天涯浪人 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:53

    I just suffered another possibility, after all posible na.omit and na.exclude checks.

    I was taking something like:

    lm(log(x) ~ log(y), data = ...)

    Without noticing that, for some values in my dataset, x or y could be zero: log(0) = -Inf

    So just another thing to watch out for!

提交回复
热议问题