How can i find the cross tabulation of the following two variables?
X Y
6 7 
8 8
9 10
I go like this:
X <- c(6,8,9)
Y <- c(7,8,10)
X <- factor(X)
Y <- factor(Y)    
I found the frequencies of X and Y with the following commands:
table(X)
table(Y)
but I don't know how to use them. I tried to print the matrix with the command
table(X,Y)
but it is not exactly the result I want, which will be like this:
  Y 6 7 8 9 10
X
6   0 1 0 0 0
7   0 0 0 0 0 
8   0 0 1 0 0
9   0 0 0 0 1
10  0 0 0 0 0 
The numbers 6,7,8,9,10 are all the different levels of X and Y.
 
    