Is the file format documented? If not you can search for a possible format if you know the values at the start of the file. For one of your files, show the results of the following: file <- "your filename here" for(what in c("double", "integer")) { for(size in c(4, 8)) { for(endian in c("little", "big")) { cat(sep="", what, "/", size, "/", endian, ":\n "); print(readBin(file, what=what, size=size, endian=endian, n=6)) } } } Do any of them look ok? If not you may want to loop over possible offsets in the file by opening a connection, reading from 1 to 7 one-byte integers, and then reading the data of interest.
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf > Of Jonsson > Sent: Thursday, May 24, 2012 11:41 PM > To: r-help@r-project.org > Subject: Re: [R] R does not recognise columns and rows as they are supposed > to be > > Yes I exactly followed what you all suggested: > X<-(82:92) ; Y<-(364:369) ##### for sellected region > > extract <- double(365) > > setwd("C:\\Users\\aalyaari\\Desktop\\New folder (10)\\") > > listfile<-dir() > > for (i in 1:365) { > + conne <- file(listfile[i], "rb") > + file1<- readBin(conne, double(), n=360*720) > + file2<-matrix(data=file1,ncol=720,nrow=360) > + extract[i]<-mean(file2[X,Y],na.rm=TRUE) > + close(conne) } > write.table(extract,"C:\\Users\\aalyaari\\Desktop\\New folder > (10)\\samregion1.txt") > > But I am still getting(negative values) all values like: > > -3.75E+306 > -1.30E+54 > -1.22E+58 > and the right ones should be like: > 22.25 > 22.76 > 33.25 > > -- > View this message in context: > http://r.789695.n4.nabble.com/R-does-not-recognise- > columns-and-rows-as-they-are-supposed-to-be-tp4631217p4631279.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. ______________________________________________ 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.