Attribute checks - Check if object allows attributes
is_attrs_allowed.RdIn R, some objects do not allow attributes to be set on them. This function
checks whether attr(x, which) <- value runs without errors. See attr()
for details.
Up to R version 4.6.0, only three object types (typeof()) disallow
attributes:
"primitive"starting in R 4.6.0."symbol"starting in R 3.5.0."NULL"starting in R 3.4.0.
Besides these, objects of type "char" and "any", which exist only in the
internals of R, always return FALSE.
Arguments
- x
[
any] An object to test.- cnd_match
[
character(1)] String to match in the condition message. If no match, the condition is re-thrown. Defaults to allow any message.- warn
[
"true"|"false"|"warn"|"error"] How to handle warnings:"false"to returnFALSE;"true"`` forTRUE;"warn"to returnTRUEbut re-throw the warning; and"error"` to throw the warning as an error.