0
votes

I am using night-time light satellite data. I have performed a calibration method between two satellite data for the same year. for which I had converted the tiff file to dataframe. Now I need to export the data frame to tiff format. following are the codes I tried but some error is shown

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

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

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

can anyone guide me on how to go about

1

1 Answers

0
votes

That is the type of message you will get when attempting to apply an S4 generic function to an object of a class for which no defined S4 method exists (or at least has been attached to the current R session).

Here's an example using the raster package (for spatial raster data), which is chock full of S4 functions.

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"’