Learn R Programming

lenght (version 0.1.0)

length: Length of an Object

Description

Length of an Object

Usage

length(x)

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.

Arguments

x

An R object.

Examples

Run this code
length(diag(4))  # = 16 (4 x 4)
length(options())  # 12 or more
length(y ~ x1 + x2 + x3)  # 3
length(expression(x, {y <- x^2; y+2}, x^y))  # 3

Run the code above in your browser using DataLab