# NOT RUN {
r <- rast(xmin=-150, xmax=-120, ymin=30, ymax=60, ncol=36, nrow=18)
values(r) <- 1:ncell(r)
e <- ext(-180, -100, 40, 70)
re <- expand(r, e)
# expand with a number of rows and columns (at each side)
re2 <- expand(r, c(2,10))
# SpatExtent
e <- ext(r)
e
expand(e, 10)
expand(e, c(10, -10, 0, 20))
# }
Run the code above in your browser using DataLab