lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) 中的错误: 'y' 中的 NA/NaN/Inf 另外:

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : NA/NaN/Inf in 'y' In addition:

我的数据集比较检查方法之间的时间

    Method      Time
    <chr>       <dbl>
1   UroCurrent  3.75
2   UroCurrent  3.52
3   UroCurrent  2.80
4   UroCurrent  2.78
5   UroCurrent  3.77
6   UroCurrent  4.62
7   UroCurrent  2.85
8   UroCurrent  3.88
9   UroCurrent  2.75
10  UroApollon  2.43
11  UroApollon  2.37
12  UroApollon  4.58
13  UroApollon  3.58

我尝试执行一种方差分析方法

> timeanova <- read_excel("TimeAnova.xlsx")
> res.aov <- aov(Method ~ Time, data = timeanova)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  NA/NaN/Inf in 'y'
In addition: Warning message:
In storage.mode(v) <- "double" : NAs introduced by coercion

由于我的数据集是完整的并且不包含任何 NA/NaN/Inf 值,所以我不明白这个错误。会不会跟用readxl导入记录有关?

方法是一个字符,我猜应该是组或自变量。你的因变量是时间,你应该这样做:

res.aov <- aov( Time ~ Method, data = timeanova)