【问题标题】:export data frame to till format将数据框导出为直到格式
【发布时间】:2021-10-13 18:23:48
【问题描述】:

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

库 (sp) 图书馆(光栅) 图书馆(rgdal)

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

(函数(类,fdef,mtable)中的错误: 无法找到签名“data.frame”、“character”的函数“writeRaster”的继承方法

谁能指导我如何去做

【问题讨论】:

    标签: raster rgdal rasterizing


    【解决方案1】:

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

    这是一个使用 raster 包(用于空间栅格数据)的示例,其中充满了 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"’
    

    【讨论】:

      猜你喜欢
      • 2022-01-27
      • 1970-01-01
      • 1970-01-01
      • 2014-09-29
      • 1970-01-01
      • 1970-01-01
      • 2021-07-09
      • 2020-08-06
      相关资源
      最近更新 更多