Hi,

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
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[indices]<-1

However, with:

myforetbin[indices]

I well get a vector with the corresponding non-null values.

Can somebody put me on the track?

All the best,

Patrick

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to