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