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 ##worked well and values heve been calculated e[e == 528.8933] <- -9999 ## no changes made to 528.8933 any suggestions please -- View this message in context: http://r.789695.n4.nabble.com/Replacing-cretin-value-in-a-file-tp4629840.html Sent from the R help mailing list archive at Nabble.com.
FAQ 7.31 Sent from my iPad On May 13, 2012, at 7:52, Jonsson <amen.alyaari at Bordeaux.inra.fr> 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 > ##worked well and values heve been calculated > e[e == 528.8933] <- -9999 ## no changes made to > 528.8933 > > any suggestions please > > > -- > View this message in context: http://r.789695.n4.nabble.com/Replacing-cretin-value-in-a-file-tp4629840.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.
Dear Jim, You may forget to add your suggestions because what I see is just my post -- View this message in context: http://r.789695.n4.nabble.com/Replacing-cretin-value-in-a-file-tp4629840p4629843.html Sent from the R help mailing list archive at Nabble.com.
On May 13, 2012, at 8:12 AM, Jonsson wrote:> Dear Jim, > > You may forget to add your suggestions because what I see is just my > postThe suggestion was to read the referenced FAQ.> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlAnd while you are referencing the FAQ from the R help pages, you might also follow the link and read the Posting Guide. It will explain why including context is requested. Most people do not want to use Nabble and many of us somewhat annoyed that Nabble users seem to expect us to use it. -- David Winsemius, MD West Hartford, CT
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 -- View this message in context: http://r.789695.n4.nabble.com/Replacing-cretin-value-in-a-file-tp4629840p4629846.html Sent from the R help mailing list archive at Nabble.com.
On May 13, 2012, at 9:08 AM, 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 advanceFrom memory ... since you have not yet learned to include context. You were advised to read the FAQ ... item 7.31. Perhaps this example will help. > x <- 7* round(528.8933/7, 6) > x== 528.8933 [1] FALSE > x [1] 528.8933> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html-- David Winsemius, MD West Hartford, CT