Learn R Programming

berryFunctions (version 1.10.0)

headtail: head and tail

Description

show head and tail of an object with one command

Usage

headtail(x, n = 1, nh = n, nt = n, na = TRUE, ...)

Arguments

x
Object
n
Number of elements/rows/lines at begin and end of object to be returned. DEFAULT: 1
nh, nt
Number for head and tail, respectively. DEFAULT: n
na
Add NA values in between to emphasize visibly that there is something inbetween the values? DEFAULT: TRUE
...
nothing

Value

head result

Details

Tries to find good methods of combining the two results acccording to codeclass(x).

See Also

head

Examples

Run this code

head(letters, n=3)
headtail(letters, n=3)

head(letters, n=-10)
headtail(letters, n=-10) # doesn't make sense for headtail

head(freeny.x, n=3)
headtail(freeny.x, n=3)

head(freeny.y, n=3)
headtail(freeny.y, n=3)

head(library, n=3)
headtail(library, n=3)
headtail(library)

ftable(Titanic)
head(stats::ftable(Titanic), n=4)
headtail(stats::ftable(Titanic), n=4)

head(table(sample(1:9, 30, TRUE)), n=3)
headtail(table(sample(1:9, 30, TRUE)), n=3)

head(table(state.division, state.region), n=3)
headtail(table(state.division, state.region), n=3)

Run the code above in your browser using DataLab