Dear R helpers,
Please have a look at the following : - Note : My goal is to find and replace all Inf's in a data array with 0. > t<-data.frame(A=c(Inf,0,0),B=c(1,2,3)) > t A B 1 Inf 1 2 0 2 3 0 3 >str(t) 'data.frame': 3 obs. of 2 variables: $ A: num Inf 0 0 $ B: num 1 2 3 > t[which(t==Inf,arr.ind=T)] [1] Inf > t[which(t==Inf,arr.ind=T)]<-0 Error in `[<-.data.frame`(`*tmp*`, which(t == Inf, arr.ind = T), value = 0) : only logical matrix subscripts are allowed in replacement Query : Why does the search work but the replace not work ? Many thanks for your time and efforts. Ashim [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.