I am a beginner in R and have two rasters with different extents. I need to resample the rasters and I use terra package for this but the output is a raster with all NAs. Does anyone have any idea how to fix it? I found a similar post but the solution that was suggested for that problem does not work in my case.
Thanks
> rast2
class : SpatRaster
dimensions : 276, 573, 3 (nrow, ncol, nlyr)
resolution : 0.0833333, 0.08333333 (x, y)
extent : -123.25, -75.50002, 26, 49 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs
source : memory
names : GID, yi, yr
min values : NA, 0.8363878, 0.1122796
max values : NA, 15.7337789, 13.2661868
> proyield2
class : SpatRaster
dimensions : 335, 527, 1 (nrow, ncol, nlyr)
resolution : 0.09027645, 0.09027645 (x, y)
extent : -24.27065, 23.30504, 0.291846, 30.53446 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs
source : memory
name : corn_relDiff_local
min value : -26.83018
max value : 27.11203
reyield <- resample(proyield2, rast2, method = 'bilinear')
> reyield
class : SpatRaster
dimensions : 276, 573, 1 (nrow, ncol, nlyr)
resolution : 0.0833333, 0.08333333 (x, y)
extent : -123.25, -75.50002, 26, 49 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs
source : memory
name : corn_relDiff_local
min value : NaN
max value : NaN