What does this mean: unable to find an inherited method for function ‘A’ for signature ‘”B”’

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

Leave a Comment