Skip to content
Prev 295634 / 398502 Next

R does not recognise columns and rows as they are supposed to be

In the absence of documentation for the file format, what="double",size=4,endian="little"
would be a good guess.

Many problems people report on this list are due to errors in reading data
into R.  Converting data from one format to another is always error-prone
and you need to check that the conversion was done correctly.  Don't  try
to analyze the imported data until you have checked the import process.

E.g., you think your files should contain 360*720 4-byte values, so look at the
number of bytes in the file with file.info(file)$size and see if it matches
the expected 360*720*4.  After you read the data into the matrix, x, look
at the quartiles with quantile(x).  Do those -9999's represent missing values?
If so, make them NA's with is.na(x) <- x==-9999 and look at the quartiles again,
with quantile(x,na.rm=TRUE).  Take a look at the pattern of the data
with image(x) or image(array(rank(x), dim=dim(x))) (or plot(x[,10]) or plot(x[20,]),
etc.).

If any these things look odd,  fix the import procedure before doing the "real"
analysis of the data.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com