To get the distribution of NA/non-NA, use table on the values of the raster.
> r = raster()
Fill with 1 to N:
> r = 1:ncell(r)
Set some cells to NA:
To count NA/non-NA, use table:
To plot this with NA in red, do:
A RAT is just a table that crosswalks the numeric values contained in an integer raster to descriptive attributes. It is not realistic to have a RAT for a true floating-point raster (eg., elevation) and really does not make much sense to. If one wants to represent a
process as nominal than you just reclassify it into the desired ranges.
A good way to ...
Are you looking for something like st_relate which implements the DE9-IM relation scheme?
This tells you how the exterior, boundary, and interior of two features relate to each other. For example two polygons that only touch at a point have no interior-interior relation (which is coded as F) and a point dimension ...
It looks like your problem is that the polygon data is multipart geometry. This means that you have multiple features (polygons) associated with single rows (attributes). Even if raster::extract works, this makes very little sense from a results standpoint. For your data to match, you need to explode your geometry into single part.
Here is an example, you ...
You can build legends with the legend function, for example with your data this looks okay:
check the help and adjust parameters to suit. It is quite flexible.
First, you are using a double bracket where you do not need to and second, it is often better to use a numeric index.
x <- c(Nile)
Here, if you use a single bracket it returns the desired statistic.
Now, if you use a numeric index you can simplify things a bit. This returns the: "P-value", "Z-value", "Sen's ...