I want to make some statistical analyses on a raster. For this I do not need the spatial information. I just need to have a list with every cell value that I can open in Excel.

I tried exporting my raster as an ASCI xyz but it was for one too long for excel to open all values in one table and also the values were different from the ones that are displayed in my GIS.

Has anyone got a solution for this? Also I am open to any other solutions that lead to me being able to do complex statistical analyses (not only mean median etc.).


It depends on the complexity of work you wish to do. ASCII files look like this when opened in any text editor.

ncols 480
nrows 450
xllcorner 378923
yllcorner 4072345
cellsize 30
nodata_value -32768
43 2 45 7 3 56 2 5 23 65 34 6 32 54 57 34 2 2 54 6 
35 45 65 34 2 6 78 4 2 6 89 3 2 7 45 23 5 8 4 1 62 ...

If you have one or two of these files. To make it super easy to work with, you can delete the first 6 lines manually. After that you should use R Studio to import this edited file as csv with space delimiter. you can find enough documentation on how to do that. This code will work y <- read.csv("x.csv", sep = " ") if you have installed all the prerequisite dependencies.

There are various reasons you should use R instead of excel or other spreadsheets. Major one being the flexibility and super fast file loading time. Plus you can use your script to apply same analysis on other such Raster file of yours.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.