Assign a time period to a SpatRaster object
assign_time_period.Rd
Assign a time period to a SpatRaster object
Examples
# Load terra package
library(terra)
#> terra 1.7.71
# Create example SpatRaster
r <- rast(nrow=10, ncol=10)
r[] <- 1:ncell(r)
# Assign a time period
assign_time_period(r, "2023")
#> class : SpatRaster
#> dimensions : 10, 10, 1 (nrow, ncol, nlyr)
#> resolution : 36, 18 (x, y)
#> extent : -180, 180, -90, 90 (xmin, xmax, ymin, ymax)
#> coord. ref. : lon/lat WGS 84 (CRS84) (OGC:CRS84)
#> source(s) : memory
#> name : lyr.1
#> min value : 1
#> max value : 100
#> time (years): 2023