Displaying 1 result from an estimated 1 matches for "myforetbin".
2004 Oct 09
2
which() and value replacement in a matrix
...hrough the archives with which() as key-word... so common. Though I am sure to have seen something about this subject
in the past could somebody put me on the track. I have a matrix (actually a data.frame) in which I would replace the non-null values
by 1.
I tried the following:
indices<-which(myforetbin > 0,arr.ind=T)
myforetbin[indices[,1],indices[,2]]<-1
and get the message:
> myforetbin[indices[,1],indices[,2]]<-1
Error in "[<-.data.frame"(`*tmp*`, indices[, 1], indices[, 2], value = 1) :
duplicate subscripts for columns
I get the same with
myforetbin[indice...