在 terra 包中读取多个栅格

问题描述

我正在更改我的空间工作流以使用 terra 包而不是 raster 包。使用光栅包,我曾经将多个光栅直接读入堆栈。

filelist_temp <- list.files(datapath("climate/World clim 1 yr Monthly Weather/LCC June and July/June"),full.names = TRUE)
temp_rasters <- stack(filelist_temp)

有没有一种简单的方法可以在 terra 中进行相同的操作?

这是我最初想到的,但它不起作用。我最终得到了一个包含 25 个 spatRasters 的列表

temp_rasters <- c(lapply(filelist_temp,rast))

解决方法

这比我想象的要简单

temp_rasters <- rast(filelist_temp)