It looks like this may be what you want - first you tabulate using table()
, then plot a heatmap of the table using heatmap()
:
set.seed(1)
data <- data.frame(V1=sample(1:10,100,replace=TRUE),V2=sample(1:10,100,replace=TRUE))
foo <- table(data)
heatmap(foo,Rowv=NA,Colv=NA)