It's because the class of your vector is numeric
. So you have to do this:
plotWaterfall.numeric <- function(x, ...) {print("Numeric vector")}
plotWaterfall(x)
[1] "Numeric vector"
You can determine the class of an object with the class()
function:
class(x)
[1] "numeric"
This behaviour is described in the help for ?UseMethod
:
Method dispatch takes place based on the class(es) of the first argument to the generic function or of the object supplied as an argument to UseMethod