Test if an object can be coerced to a given S4 class.
Maybe useful inside
if() to ensure that calling
as(object, Class) will find a method.
any R object, typically of a formal S4 class.
an S4 class (see
a scalar logical,
TRUE if there is a
(as defined by e.g.
setAs) for the signature
(from = class(object), to = Class).
m <- matrix(pi, 2,3) canCoerce(m, "numeric") # TRUE canCoerce(m, "array") # TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.