I'm helping out a friend with statistic on R while not knowing it. I'm trying to do a simple fisher.test(df) so far I've been able to select the data he wants to analyse.
Below my code
from the dim function I understand that it is a 2 dimensions matrix
library(data.table)
data = fread(myFILE, header = FALSE, select = c(9,46))
dim(data)
# [1] 68 2
print(data)
> print(d)
V9 V46
1: Question1 ? Question2 ?
2: 30 No
3: 25 Yes
4: 24 Yes
5: 25 Yes
6: 27 Yes
7: 27 Yes
8: 25 Yes
9: 26 Yes
10: 25 Yes
11: 24 Yes
12: 26 No
13: 24 Yes
14: 27 Yes
15: 26 Yes
16: 26 Yes
17: 26 Yes
18: 27 Yes
19: 26 Yes
data = d[-1,] # to remove the 1: Question...
fisher.test(data)
Error in fisher.test(data) :
all entries of 'x' must be nonnegative and finite
What am I missing? Should I convert Yes/No to 1/0 ?
Thanks for your help.