将数据框导出为till格式

问题描述 投票:0回答:1

我正在使用夜间灯光卫星数据。我对同年的两个卫星数据进行了校准方法。为此我已将 tiff 文件转换为数据帧。现在我需要将数据帧导出为 tiff 格式。以下是我尝试过的代码,但显示了一些错误

library (sp)
library (raster)
library (rgdal)

writeRaster(NTL_new2, "E:\phd\data\calliberation test\rstudio\test.tif", format="GTiff", overwrite=TRUE)

(function (classes, fdef, mtable) 中的错误:无法找到 函数“writeRaster”的继承方法用于签名 ‘“数据框”,“字符”’

任何人都可以指导我如何去做吗?

r raster rgdal rasterizing
1个回答
0
投票

这是当尝试将 S4 通用函数应用于不存在定义的 S4 方法(或至少已附加到当前 R 会话)的类的对象时,您将收到的消息类型。

这是一个使用栅格包(用于空间栅格数据)的示例,其中充满了 S4 函数。

library(raster)

## raster::rotate() is an S4 function with just one method, for "Raster" class objects
isS4(rotate)
# [1] TRUE
showMethods(rotate)
# Function: rotate (package raster)
# x="Raster"

## Lets see what happens when we pass it an object that's *not* of class "Raster"
x <- 1:10
class(x)
# [1] "integer"
rotate(x)
# Error in (function (classes, fdef, mtable)  : 
#   unable to find an inherited method for function ‘rotate’ for signature ‘"integer"’
© www.soinside.com 2019 - 2024. All rights reserved.