且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用R中的功能对栅格和位置列表进行采样

更新时间:2023-02-18 11:24:39

设法解决了这个问题(对我来说是高五分;) 不幸的是,我设法通过循环实现了这一点,很高兴看到一个函数示例.

Managed to solve this (big high five to myself ;) Unfortunately I managed to do it with a loop, would be great to see an example of a function.

samplevaluesnext <- vector("list",length(sample.set))

## Look up values
for (j in 1:length(sample.set)) {
        for (i in 1:(length(rasters)-1)) {
                samplevaluesnext[[j]][[i]] <- data.frame(sample.set[[j]][[i+1]],
                                                         extract(rasters[[i]], 
                                                                 as.data.frame(sample.set[[j]][i+1])))
        }
}