I have the following error when trying to use the writeraster
function in R:
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘writeRaster’ for signature ‘"SpatialGridDataFrame", "character"’
This is the code:
library(rgdal)
x <- readGDAL("LC81360442014322LGN00_B5.TIF")
z <- reflconv(x,2.0000E-05,-0.100000)
writeRaster(z,filename="test.tif",format="GTiff",overwrite=TRUE) #ERROR LINE
I want to store variable z in a raster file. Can any one help me out from this error?
Best Answer
First coerce z to a RasterLayer: