All objects in R have at least two attributes: mode and length. The length attributes indicates the number of components in the object. For a vector, matrix or array the length is simply the number of elements. For a character string, it is the number of characters in the string. For a list it is the number of components in the list --- so for example if a data frame has 4 columns and 50 rows, its length is 4 but if it is converted to a matrix its length is 200.
Examples:
mode of x | mode(x) |
length of x | length(x) |
all attributes of x except length or mode | attributes(x) |
create new attribute, title | attr(x, "title")<-"x is IBM stock prices" |
view a particular attribute, say title | attr(x, "title") |