I have a matrix with of 1's and 0's. I want to replace all the 1's by an identifier code for that row (the identifier code is given in row 2)
I tried:
dax[,2:109] <- replace(dax[,2:109],dax[,2:109]==1,dax[2,])
but this isn't working right. I've tried to set up a loop, but I've had no success so far.
I'm new to R. Any help is appreciated