length {base} R Documentation

Length of an Object

Description


Get or set the length of vectors (including lists) and factors,
and of any other R object for which a method has been defined.

Usage

length(x,
    newSize = -1);

Arguments

x

an R object. For replacement, a vector or factor.

newSize

a non-negative integer or double (which will be rounded down). [as integer]

Details

Authors

SMRUCC genomics Institute

Value

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 "").

clr value class

Examples


[Package base version 2.33.856.6961 Index]