0

我正在尝试从 data.frame 中保存 .csv 栅格文件,但发生错误。

library(dismo)
sp <- gbif("Neurergus ","kaiseri")   
sp <- sp[sp$basisOfRecord %in% c("HUMAN_OBSERVATION", "OBSERVATION", "PRESERVED_SPECIMEN"), c("lon", "lat")]    
sp$species <- 1   
sp <- na.omit(sp)

writeRaster(spg, "zzz.csv")

#Error in (function (classes, fdef, mtable)  : 
#  unable to find an inherited method for function ‘writeRaster’ for signature ‘&quot;data.frame", "character"’
4

1 回答 1

0

您想将 a 写入data.frame文件.csv。你应该使用write.csv它。

write.csv(spg, "zzz.csv", row.names=FALSE)

writeRaster用于写入栅格数据。

于 2021-11-12T16:09:58.203 回答