Safely get the attribute of an object. An error is given if the attribute does not exist (and do.stop = TRUE)

getAttribute(x, attributeName, do.stop = TRUE)

Arguments

x

object from which to take the attribute

attributeName

name of the attribute to be returned

do.stop

if TRUE (default) an error is raised if the attribute does not exist.