head.list: Return the first or last part of a list

Description Usage Arguments Value See Also Examples

Description

This function recurses over the first/last elements of a list to return a compact view of the list.

Usage

1
2
3
4
5
## S3 method for class 'list'
head(x, n = 6L, m = n, ...)

## S3 method for class 'list'
tail(x, n = 6L, m = n, ...)

Arguments

x

A list of R objects.

n

A single integer. If positive, size for the resulting object: number of elements for a vector (including lists), rows for a matrix or data frame or lines for a function. If negative, all but the n last/first number of elements of x.

m

As n. If x is a list, m controls the number of elements from the list to show. Defaults to n.

...

Arguments passed to head.

Value

Returns a list of length m of the first/last element of x where the first n elements of each entry is shown.

See Also

head

Examples

1
2
3
4
5
6
7
8
9
x <- list(A = letters[1:9],           B = matrix(runif(30), ncol = 3),
          C = as.list(LETTERS[1:10]), D = function(x) { x^2 + 2*x + 1},
          D = combn(1:5, m = 4),      E = "A simple string.",
          F = data.frame("unif" = runif(10), "norm" = rnorm(10)))
str(x)
head(x, n = 3L)
head(x, n = 2L, m = 7L)
tail(x, n = 3L)
tail(x, n = 3L, m = 3L)

AEBilgrau/Bmisc documentation built on May 5, 2019, 11:28 a.m.