[R] which() and value replacement in a matrix
patrick.giraudoux at univ-fcomte.fr
Sat Oct 9 12:28:49 CEST 2004
I cannot go through 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
I tried the following:
indices<-which(myforetbin > 0,arr.ind=T)
and get the message:
Error in "[<-.data.frame"(`*tmp*`, indices[, 1], indices[, 2], value = 1) :
duplicate subscripts for columns
I get the same with
I well get a vector with the corresponding non-null values.
Can somebody put me on the track?
All the best,
More information about the R-help