Dear all, I have a matrix as follows: a=matrix(c(1,2,3,1,2,3,1,2,3,6,5,7,7,5,7,5,6,5,"Y", "N","Y","Y","N","Y", "N","Y","Y"),ncol=3) > a [,1] [,2] [,3] [1,] "1" "6" "Y" [2,] "2" "5" "N" [3,] "3" "7" "Y" [4,] "1" "7" "Y" [5,] "2" "5" "N" [6,] "3" "7" "Y" [7,] "1" "5" "N" [8,] "2" "6" "Y" [9,] "3" "5" "Y" [10,] "1" "5" "Y"
Here, the first two columns are considered as factors, the third columns are values. I want to categorize a[,3] based on a[,1] and a[,2], ie, I want to create a table as: 1 2 3 5 Y 1 0 1 N 1 5 0 6 Y .. .. N .. .. .. 7 Y .. .. .. N .. .. .. I tried the CorssTable function, but it couldn't give what I want. I just wonder is there any way/function that can do this job? Thank you very much! Cheers, Jessie [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.