Shapiro test: is.numeric (x) is not TRUE

42,387

Is the data you are providing to shapiro.test a vector? If it is a data.frame then it will return this error. Try using shapiro.test(Abund2014layer$Abundance)

If you still get the error, you can see what class your vector is by using the class(Abund2014layer$Abundance) function. If it is not numeric, you can transform it and perform the Shapiro test in one line as follows;

shapiro.test( as.numeric( Abund2014layer$Abundance ) )

Share:
42,387
Victor
Author by

Victor

Updated on May 10, 2020

Comments

  • Victor
    Victor about 4 years

    I have problems with the shapiro.test function to check normality. I keep getting the error

    is.numeric (x) is not TRUE
    

    I use the following dataset (name: Abund2014layer):

    Abundance
    0.91567
    0.01256
    ...
    0.85605
    

    which goes on for 75 rows.

    I implement it as follows:

    shapiro.test(Abund2014layer)
    

    But I keep getting the error. The input should be a numeric vector of data values, I don't see where it goes wrong.