peek: Peek at the top of a text file

View source: R/utils.R

peekR Documentation

Peek at the top of a text file

Description

This returns a character vector which shows the top n lines of a file.

Usage

peek(x, n = 5)

Arguments

x

a filename

n

the number of lines to return

Value

A character vector of the first n lines of the file.

Examples

## Not run: 
filename <- tempfile()
x <- matrix(round(rnorm(10^4), 2), 1000, 10)
colnames(x) <- letters[1:10]
write.table(x, file = filename, row.names = FALSE, quote = FALSE)
peek(filename)

## End(Not run)

stephenturner/Tmisc documentation built on April 21, 2024, 8:31 a.m.