I am trying to get the mean of the data read from an excel sheet.
library(readxl)
URL <- "C:/Users/user/Documents/R/test.xlsx"
pivot <- read_excel(URL,sheet=2)
pivot
mean(pivot$Experimental)
Data in excel below. This data is shown on the console window when executing the code above.
Experimental Comparison
-0.255 -0.324
-0.213 -0.185
-0.190 -0.299
-0.185 -0.144
-0.045 -0.027
-0.025 -0.039
-0.015 -0.264
0.003 -0.077
0.015 -0.017
0.020 -0.169
0.023 -0.096
0.040 -0.330
0.040 -0.346
0.050 -0.191
0.055 -0.128
0.058 -0.182
I am getting the below warning message and result of the mean function is NA.
Warning message:
In mean.default(pivot$Experimental) :
argument is not numeric or logical: returning NA
str(pivot)
, i.e. edit your question! – jogoExperimental
column isfactor
for some reason. Coerce them throughpivot$Experimental<-as.numeric(as.character(pivot$Experimental))
– nicolachr " -0.255"
etc etc result ofstr(pivot)
– AyubxNAs introduced by coercion
– Ayubxdput(pivot)
to let us see what it actually contains? Every question should be reproducible, you won't receive any help if you don't provide the relevant information. – nicola