Question

    word    freq.x  freq.y
1             1       1
2   1D        1       NA
3   5         2       NA
4   a         5       18
5   a0        8       4
6   about     1       NA
7   all       2       2
8   already   1       NA
9   always    2       2
10  and       4       12
11  another   1       NA

Let's say I have a data frame that looks like this. It is basically a word frequency table. How can I convert it into a table so that I can run the chi squared test of independence on it?

chisq.test(data.table)
Was it helpful?

Solution

chisq.test(data.table$freq.x, data.table$freq.y) or chisq.test(as.matrix(data.table[c('freq.x', 'freq.y')]))

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top