Length of a Vector or List

DESCRIPTION:
Returns an integer that describes the length of the object.

USAGE:
length(x)
length(x) <- value

REQUIRED ARGUMENTS:
x:
any object.

OPTIONAL ARGUMENTS:
value:
an integer.

VALUE:
an integer that gives the length of the object, i.e., the number of elements in the object.

SIDE EFFECTS:
When a value is assigned to the length of an object, then the object is either shortened or lengthened to the new length. Attributes of an object that is assigned a new length are deleted in order to avoid the creation of inconsistent data objects. (However, the names attribute of an object is retained, shortened or lengthened as needed.) Missing values are placed at the end of a vector that is given a longer length.

DETAILS:
These are generic functions; currently there is a "length<-" method for factors which retains the class and levels attributes.

SEE ALSO:
mode , attributes , ncol , dim .

EXAMPLES:
z <- list(a=1,b=letters,c=1:5)
length(z) # returns the value 3
length(z$c) # returns the value 5