arun
2015-Feb-01 14:55 UTC
[R] Is there a way to map data from Binary format to Numerical numbers?
Try indx <- which(!!mat, arr.ind=TRUE) v1 <-unname(sapply(split(indx[,2], indx[,1]),toString)) cat(paste(v1, collapse="\n"), sep="\n") 1, 2, 3, 6, 7, 8, 9 1, 2, 3, 6, 8, 9 1, 3, 4, 6, 7, 8, 9 1, 8 1, 3, 6, 7, 8, 9 1, 3, 4, 6, 8, 9 1, 3, 5, 9 A.K. Hi, Is there a way to map data from Binary format to Numerical numbers? example: I have text files, where each record consists of several items (9 items) 1, means item appear 0, means item absent 1,1,1,0,0,1,1,1,1 1,1,1,0,0,1,0,1,1 1,0,1,1,0,1,1,1,1 1,0,0,0,0,0,0,1,0 1,0,1,0,0,1,1,1,1 1,0,1,1,0,1,0,1,1 1,0,1,0,1,0,0,0,1 I want transform my data to numerical numbers in ascending order, such that when items is absent, i didn't print it, but keep increase the counter. for example, the above binary format will be: , 1,2,3,6,7,8,9 1,2,3,6,8,9 1,3,4,6,7,8,9 1,8, 1,3,6,7,8,9 1,3,4,5,7,8 1,3,5,9