R: Backport of lengths for R < 3.2.0

lengths {backports} | R Documentation

## Backport of lengths for R < 3.2.0

### Description

See the original description in `base::lengths`.

### Usage

    lengths(x, use.names = TRUE)

### Examples

    # get function from namespace instead of possibly getting
    # implementation shipped with recent R versions:
    bp_lengths = getFromNamespace("lengths", "backports")

    bp_lengths(list(1:3, 2))

[Package backports version 1.1.2 Index]