Learn R Programming

terra (version 1.8-29)

deepcopy: Deep copy

Description

Make a deep copy of a SpatRaster or SpatVector. This is occasionally useful when using an in-place replacement function that does not make copy, such as set.ext.

Usage

# S4 method for SpatRaster
deepcopy(x)

# S4 method for SpatVector deepcopy(x)

Value

Same as x

Arguments

x

SpatRaster or SpatVector

Examples

Run this code
r <- rast(ncols=10, nrows=10, nl=3)
x <- r
y <- deepcopy(r)
ext(r)
set.ext(x, c(0,10,0,10))
ext(x)
ext(r)
ext(y)

Run the code above in your browser using DataLab