yuo将无法将结果列表的栅格相乘,因此错误(调查列表)。
但您可以轻松堆叠堆栈列表:
# make some dummy rasters a <- raster(xmn=0,xmx=5,ymn=0,ymx=5,res=1) a[] <- sample(1:5,25,replace=T) b <- raster(xmn=0,xmx=5,ymn=0,ymx=5,res=1) b[] <- sample(1:5,25,replace=T) c <- raster(xmn=0,xmx=5,ymn=0,ymx=5,res=1) c[] <- sample(1:5,25,replace=T) d <- raster(xmn=0,xmx=5,ymn=0,ymx=5,res=1) d[] <- sample(1:5,25,replace=T) # imagine st1 and st2 are rain rasters, st3 and st4 are snow st1 <- stack(a,b,c,d) st2 <- stack(d,a,c,b) st3 <- stack(c,b,a,d) st4 <- stack(a,d,b,c) # make the rain and snow lists, just like your code above. we have a list object of two stacks. list1 <- list(st1,st2) list2 <- list(st3,st4) # error below list1 * list2 Error in list1 * list2 : non-numeric argument to binary operator # however, stack them and multiply: stack(list1) * stack(list2) # check e.g. identical(getValues(stack(list1)[[1]]),getValues(a)) [1] TRUE