I have a vector like this :
> agg$RNAtype
[1] "HnRn" "HyRy" "HnRn" "HyRn" "HnRn" "HnRn" "HnRn" "HnRn" "HnRy" "HnRn" "HnRy"
[12] "HnRn"
Now when I use table function, it gives the following:
> table(agg$RNAtype)
HnRn HnRy HyRn HyRy
8 2 1 1
But I want to make a 2x2 contingency table (in the form of a matrix), where the first row will have values of HnRn and HyRn. And the second row will have values of HnRy and HyRy. How can I do it?
I am ultimately planning to do fisher's exact test and chisquare test.