Replace the layers of SpatRaster with (layers from) another SpatRaster or replace variables of a SpatVector. You can also create new layers/variables with these methods.
Usage
# S4 method for SpatRaster,numeric
[[(x, i) <- value
# S4 method for SpatRaster,character
[[(x, i) <- value
# S4 method for SpatVector,numeric
[[(x, i) <- value
# S4 method for SpatVector,character
[[(x, i) <- value