'Error in (function (cl, name, valueClass) : ‘proj4string’ is not a slot in class “NULL”

I am having error running a buffer function. The "error messages" appears as follow: Error in (function (cl, name, valueClass) : ‘proj4string’ is not a slot in class “NULL”

This is my scipt:

a.x <- cfma[!cfma$No=="NULL",]
## internal buffer to keep all plots within the site boundary

a <- buffer(a.x, width=-120, dissolve=TRUE) #####
## crop Geoville map to the site of interest
b <- crop(lc,a)
       ## remove NA values from the raster
c <- mask(b,a)
## remove any 0 from the raster
c[c==0] <- NA

...

Please, is there any help?

r


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source