我正在寻找最有效的方法来将任何Raster*
对象转换为data.frame
,同时保留xy
数据。
library(raster)
library(sp)
# Read in our raster stack
s <- readRDS(gzcon(url("http://web.pdx.edu/~porlando/stack.RDS")))
# Converting to data.frame takes ~6 minutes!
df <- as.data.frame(s, xy = T, na.rm = T)