Hi Julien, Hope you are very well. Thank you so much for the reply!
I hope I've understood properly what you're expecting. > Sorry :( I made the question several times to try to make it clear lol Provided your vector values are ordered properly, you can add it as a new > layer in an existing SpatRaster using "$" as for a data.frame. > They have different orders in fact and they have missing values in the rast to make it more interesting lol > The terra::merge method may be used for different SpatRasters or between > SpatVector and data.frames but you could prepare new layers from the > original raster values using base::merge with your "ID" column. > Yes, but it returns a data frame (point 4 of the example above) and I wanted to get a raster with additional layers as output (one for each data frame col). > Regarding the temporal aspect, it would mean, as I understood it, that you > should have two data.frames containing the features to be included instead > of one (for years 2001 and 2002). > Surely not the most elegant way to do it below with base R functions but > it should work. > If anyone has a more appropriate solution, I'd be greatly interested too! > Super elaborated and detailed code Julien! Thank you so much and indeed, it works well! Cheers, M. [[alternative HTML version deleted]] _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo