Skip to contents

transform Raster* to data frame ready for ggplot2

Usage

as_data(r, na.rm = FALSE, melt = TRUE)

Arguments

r

Raster* object transform

na.rm

boolean should NA pixels be removed

melt

boolean should the raster be melted (default is TRUE)

Value

a data frame containing x, y, the coordinates; variable, the layer names; value the pixel value.

Details

melt is used to facilitate ploting of raster stacks