On 13-05-2012, at 15:08, Jonsson wrote:

> Dear All, 
> 
> I am trying to replace a value of 528.8933 to -9999 in my file 
> 
> t<- file("C:\\Users\\Amin\\Desktop\\1999n_Resample11.img", "rb") 
> e=readBin(t, double(), size=4,n=720*360, signed=TRUE) 
> e[e != -9999] <- e[e != -9999]*0.0099 + 477.65 -273.15  
> 
> This code given above would read a binary file . Then It would do some
> clculations to  e.  That worked well. I opend the file again in order to
> look at the results    and I found weird numbers ( 528.8933).
> 
> I then used this  line      >e[e == 528.8933] <- -9999            to replace
> the value of 528.8933  by -9999. I got no errors but when I looked again at
> the values, I found them as they were(528.8933 is still there) 
> any idea on how to replace a value by another value?Thanks in advance
> 

Please read the R FAQ section 7.31  "Why doesn't R think these numbers are 
equal?"

http://cran.r-project.org/faqs.html
http://cran.r-project.org/doc/FAQ/R-FAQ.html

Berend

______________________________________________
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.

Reply via email to