What is the Purpose of Attributes in R?

Attributes in R:

Attributes can be attached to any R object except NULL and they are used quite extensively. Attributes are stored, by name, in a list. All attributes can be retrieved using attributes, or any particular attribute can be accessed or modified using the attr function. It can be used by programmers to attach any sort of information they want to any R object.


> x = 1:10
> attr(x, "foo") = 11
> x