as_tibble: Convert a Raster to a data frame.

Description Usage Arguments Details Value Examples

Description

Generate a data frame version of any raster object. Use the arguments 'cell', 'dim', 'split_date' and 'value' to control the columns that are included in the output.

Usage

1
2
3
## S3 method for class 'BasicRaster'
as_tibble(x, cell = TRUE, dim = nlayers(x) > 1L,
  value = TRUE, split_date = FALSE, xy = FALSE, ...)

Arguments

x

a RasterLayer, RasterStack or RasterBrick

cell

logical to include explicit cell number

dim

logical to include slice index

value

logical to return the values as a column or not

split_date

logical to split date into components

xy

logical to include the x and y centre coordinate of each cell

...

unused

Details

If the raster has only one layer, the slice index is not added. Use 'dim = FALSE' to not include the slice index value.

Value

a data frame ('tbl_df'/'tibble' form)

Examples

1
2
3
4
#library(tabularaster)
#library(tibble)
#as_tibble(raster::raster(volcano))
#as_tibble(raster::setZ(raster::raster(volcano), Sys.Date()), cell = TRUE)

Example output



tabularaster documentation built on May 2, 2019, 7:02 a.m.