length {base} | R Documentation |
Get or set the length of vectors (including lists) and factors,
and of any other R object for which a method has been defined.
length(x,
newSize = -1);
The default method for length currently returns a non-negative integer of length 1, except for vectors of more than 2^31 - 1 elements, when it returns a double.
For vectors(including lists) And factors the length Is the number of elements. For an environment it Is the number of objects in the environment, And NULL has length 0. For expressions And pairlists (including language objects And dotlists) it Is the length of the pairlist chain. All other objects (including functions) have length one: note that For functions this differs from S.
The replacement form removes all the attributes Of x except its names, which are adjusted (And If necessary extended by "").