# NOT RUN {
r <- rast(ncols=10, nrows=10, nl=3)
tm <- as.Date("2001-05-03") + 1:3
time(r) <- tm
time(r)
x <- r
time(x) <- tm + 365
time(x)
time(r)
y <- deepcopy(r)
time(y) <- tm - 365
time(y)
time(r)
# or make a new object like this
z <- rast(r)
time(z) <- tm
time(z)
time(r)
# }
Run the code above in your browser using DataLab