list.take: Take a number of elements

Description Usage Arguments See Also Examples

View source: R/list.take.R

Description

Take the first n elements out from a list or vector.

Usage

1
list.take(.data, n, force = FALSE)

Arguments

.data

list or vector

n

integer. The number of elements to take

force

TRUE to disable the length check

See Also

list.takeWhile, list.skip, list.skipWhile

Examples

1
2
3
x <- list(a=1,b=2,c=3)
list.take(x,1)
list.take(x,10)

Example output

$a
[1] 1

$a
[1] 1

$b
[1] 2

$c
[1] 3

rlist documentation built on Sept. 5, 2021, 5:30 p.m.