rnannaanovainf

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


My dataset compares times between examination methods

    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

I try to perform one way ANOVA analysis

> 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

Since my data set is complete and does not contain any NA/NaN/Inf values I don't understand the error. Could it be related to importing the record with readxl?


Solution

  • Method is a character and I am guessing should be the group or independent variable. your dependent variable is Time and you should do it like:

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