peek: Peek into a text file

Description Usage Arguments Value Author(s) See Also Examples

View source: R/core.R

Description

This function looks at the first elements of a file, format it into a data frame and displays it. It can also just show the first lines of the file without formatting into a DF.

Usage

1
peek(path, onlyLines = FALSE, n, view = TRUE)

Arguments

path

Path linking to the text file.

onlyLines

Default is FALSE. If TRUE, then the first n lines are directly displayed without formatting.

n

Integer. The number of lines to extract from the file. Default is 100 or 5 if onlyLine = TRUE.

view

Logical, default it TRUE: whether the data should be displayed on the viewer. Only when onlyLines = FALSE.

Value

Returns the data invisibly.

Author(s)

Laurent Berge

See Also

See peek to have a convenient look at the first lines of a text file. See guess_delim to guess the delimiter of a text data set. See guess_col_types to guess the column types of a text data set.

See hdd, sub-.hdd and cash-.hdd for the extraction and manipulation of out of memory data. For importation of HDD data sets from text files: see txt2hdd.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# Example with the iris data set
iris_path = tempfile()
fwrite(iris, iris_path)


# The first lines of the text file on viewer
peek(iris_path)


# displaying the first lines:
peek(iris_path, onlyLines = TRUE)

# only getting the data from the first observations
base = peek(iris_path, view = FALSE)
head(base)

hdd documentation built on Nov. 6, 2019, 5:07 p.m.