peek | R Documentation |
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.
peek(path, onlyLines = FALSE, n, view = TRUE)
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 |
Returns the data invisibly.
Laurent Berge
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
.
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.