I am trying to plot a RasterStack using ggRGB but I am getting the error:
Error in grid.Call.graphics(C_raster, x$raster, x$x, x$y, x$width, x$height, : cannot allocate memory block of size 67108864 Tb
The RasterSTack imported is only 13 mb so I'm assuming this is a coding issue.
My code:
library(ggplot2)
library(ggmap)
library(RStoolbox)
library(raster)
BVTWaer <- raster::stack("E:/R/DataViz/shapefiles/BVTW/BeaverViz2.tif")
> BVTWaer
class : RasterStack
dimensions : 1819, 2623, 4771237, 3 (nrow, ncol, ncell, nlayers)
resolution : 1, 1 (x, y)
extent : 0, 2623, 0, 1819 (xmin, xmax, ymin, ymax)
crs : NA
names : BeaverViz2.1, BeaverViz2.2, BeaverViz2.3
min values : 0, 0, 0
max values : 255, 255, 255
ggplot() +
ggRGB(img = BVTWaer,
r = 1, g = 2, b = 3,
maxpixels = 5e+10,
ggLayer = TRUE)
Error in grid.Call.graphics(C_raster, x$raster, x$x, x$y, x$width, x$height, :
cannot allocate memory block of size 67108864 Tb