I'm trying to pass all the numbers in a column of a dataframe to be analysed using wilcox.test(·)
in R.
If I pass c(1,2,3)
it works just fine, but I want to pass a column from a pre-existing database into the function without typing it out completely. (There are ~2million rows)
Passing the column gives the error : 'x' must be numeric.
(Understandably so)
Sample data:
AA AC AD AE AF
0.6047619 NA -1.0000000 1.0059524 -1.000000
-0.2348790 NA 0.5812500 0.1294643 -1.000000
0.9523810 -1 -1.0000000 -1.0000000 -1.000000
Statement used:
{print(wilcox.test(list, y = NULL, correct = TRUE, mu = 0, exact = NULL))}
Error message :
Error in wilcox.test.default(list, y = NULL, correct = TRUE, mu = 0, exact = NULL) :
'x' must be numeric
List is one column of the dataframe. From AA to 0.9523810.