Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

xyLayer

xyLayer


Description

Create a numeric vector from a function of the coordinates.

Usage

xyLayer(object, dirXY = y, vector = TRUE, maxpixels)

Arguments

object

A Raster or a SpatRaster object.

dirXY

A expression indicating the function of x and y (coordinates of the Raster object) to be evaluated.

vector

Logical. If TRUE (default) a numeric vector is returned, else a Raster or a SpatRaster object is returned.

maxpixels

A positive integer giving the number of cells to display, for sampleRegular or spatSample.

Value

A numeric vector or a Raster/SpatRaster object.

Author(s)

Oscar Perpiñán Lamigueiro.

See Also

init, substitute, eval

Examples

f <- system.file("external/test.grd", package="raster")
r <- raster(f)
dirX <- xyLayer(r, x)
dirXY <-xyLayer(r, sqrt(x^2 + y^2))

rasterVis

Visualization Methods for Raster Data

v0.50.2
GPL-3
Authors
Oscar Perpinan Lamigueiro [cre, aut] (<https://orcid.org/0000-0002-4134-7196>), Robert Hijmans [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.