Question

I'm trying to use R for the first time, I have never taken courses and have some questions. the first is this: when I try to do the mean of some Temperature values (they are all between 18.15 and 18.40) I get this answer "Warning message: In mean.default(d_Temp_Experiment$value) : argument is not numeric or logical: returning NA" I dont' have the same problem with values of PAR 5that are all integer numbers and with values of pH all decimal numbers like 8.831... Can you tell what I do wrong?

Was it helpful?

Solution

As Arun hints at it could be that the column is character rather than numeric. If you are sure that all the values are correct you could coerce the values with

d_Temp_Experiment$value <- as.numeric(d_Temp_Experiment$value)

You might have the below sort of business going on.

myvector <- c(0,1,2,3,4,5,"6","7")
mv <- as.numeric(myvector)
mean(myvector)
mean(mv)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top