Skip to contents

peek_csv_file() reads a CSV file and provides a summary of its contents, including the number of columns, rows, and cells. It is useful for quickly inspecting the structure of a CSV file without loading the entire dataset into memory.

Usage

peek_csv_file(file, delim = ",", skip = 0, has_header = TRUE)

Arguments

file

A string specifying the path to the file.

delim

A string specifying the delimiter used in the file (default: ",").

skip

An integer specifying the number of lines to skip before reading the file (default: 0).

has_header

A logical flag indicating whether the file has a header row. If TRUE, the first row is treated as column names (default: TRUE).

Value

An invisible NULL. This function is used for its side effect.

Examples

library(datasets)
library(readr)

file <- tempfile()

write_csv(mtcars, file)

peek_csv_file(file)
#> The file has 11 columns, 32 rows, and 352 cells.
#> The file has 11 columns, 32 rows*, and 352 cells. # Expected