peek {hdd} | R Documentation |
Peek into a text file
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
peek(path, onlyLines = FALSE, n, view = TRUE)
Arguments
path |
Path linking to the text file. |
onlyLines |
Default is |
n |
Integer. The number of lines to extract from the file. Default is 100 or 5 if |
view |
Logical, default it |
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
# 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)