Does anyone have experience about how to convert a matrix to binaryMatrix using Recommenderlab package? Thanks, Jing [[alternative HTML version deleted]]
Michael Hahsler
2011-Aug-30 22:54 UTC
[R] convert a matrix to binaryMatrix in Recommenderlab
Hi Jing recommenderlab is still under heavy development and quite far away from version 1.0-0. Here is some code to create a binaryRatingMatrix from a 0-1 matrix: library(recommenderlab) ## create a 10x10 0-1 matrix m <- matrix(sample(c(0,1),100, replace=TRUE), nrow=10, ncol=10) m ## coerce it into a binaryRatingMatrix b <- as(m, "binaryRatingMatrix") b ## coerce it back to see if it worked as(b, "matrix") Hope this helps, -Michael -- Dr. Michael Hahsler, Visiting Assistant Professor Department of Computer Science and Engineering Lyle School of Engineering Southern Methodist University, Dallas, Texas (214) 768-8878 * mhahsler at lyle.smu.edu * http://lyle.smu.edu/~mhahsler