[GRASS-stats] How to make histogram in R from raster of grass
pvanbosgeo
p.vanbreugel at gmail.com
Mon Oct 7 01:00:47 PDT 2013
If you import a GRASS raster, you'll get a SpatialGridDataFrame object.
Suppose your spatialgriddataframe is called 'myrast'. You can find out the
structure of that object using str(myrast). You'll find that the raster
values are in myrast at data. You can extract the data as data frame
myrast.data <- myrast at data
Now you can create histograms as you would normally do.
Especially when you are dealing with very large raster layers, a good
alternative is to use the 'raster' package to import the raster layer. You
can then use the hist function to create a histogram of the values of a
RasterLayer directly. For large datasets the hist function in the raster
package automatically uses a sample.
-----
---
http://pvanb.wordpress.com/
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-make-histogram-in-R-from-raster-of-grass-tp5049699p5082132.html
Sent from the Grass - Stats mailing list archive at Nabble.com.
More information about the grass-stats
mailing list