Skip to content
Prev 21996 / 29559 Next

Question on histograms from Raster and RasterVIS packages

Hello!

Yes, it sorted the problem but maybe not as we were expecting, you've
"liberated" me from the raster package 3% data limitation and now I can
work with it easily as a normal histogram.

Basically the trick that I got from the "readRAST6" function you suggested
is that it converts it into sp objects (SpatialGridDataFrame in this case i
guess). From here it is easy: all I need is to convert the rasters to an sp
object and from there I am back working with normal hist functions.

So, using the conversion: as(inputraster,"SpatialGridDataFrame") sorted it
out. The rest is history. I hope they update this method into the raster
package because there is no need to be limited to a 100 000 sample which is
usually kind of low for RS data.

Found a similar limitation on usdm package recently which chooses to
needlessly convert a whole raster into a data.frame before calculating VIF
between variables. For huge rasters, it would kill off the computer memory.
Because of that, I guess the authors also made a limit on the sample size
(which was not what was actually killing the computer memory)

Dr Greg

Yes, I think the rasterVIS package uses grid. maybe it can be inserted when
we call the histogram function, but making it do a vertical line might be
kind of complicated, I think just from looking to how it is called.

Thank you guys for the suggestions!!

I jump between them also, but making graphs is usually easy enough just
using R. anyway, it is so great to have all these awesome languages and
softwares linked together.

Best of luck for all!
Nuno
On 18 November 2014 18:38, Thomas Adams <tea3rd at gmail.com> wrote: