Learn R Programming

grepreaper (version 0.1.0)

grep_count: grep_count: Efficiently count the number of relevant records from one or more files using grep

Description

grep_count: Efficiently count the number of relevant records from one or more files using grep

Usage

grep_count(
  files = NULL,
  path = NULL,
  file_pattern = NULL,
  pattern = "",
  invert = FALSE,
  ignore_case = FALSE,
  fixed = FALSE,
  recursive = FALSE,
  word_match = FALSE,
  only_matching = FALSE,
  skip = 0,
  header = TRUE,
  include_filename = FALSE,
  show_cmd = FALSE,
  show_progress = FALSE,
  ...
)

Value

A data.table containing file names and counts.

Arguments

files

Character vector of file paths to read.

path

Optional. Directory path to search for files.

file_pattern

Optional. A pattern to filter filenames when using the path argument. Passed to list.files.

pattern

Pattern to search for within files (passed to grep).

invert

Logical; if TRUE, return non-matching lines.

ignore_case

Logical; if TRUE, perform case-insensitive matching (default: TRUE).

fixed

Logical; if TRUE, pattern is a fixed string, not a regular expression.

recursive

Logical; if TRUE, search recursively through directories.

word_match

Logical; if TRUE, match only whole words.

only_matching

Logical; if TRUE, return only the matching part of the lines.

skip

Integer; number of rows to skip.

header

Logical; if TRUE, treat first row as header.

include_filename

Logical; if TRUE, include source filename as a column.

show_cmd

Logical; if TRUE, return the grep command string instead of executing it.

show_progress

Logical; if TRUE, show progress indicators.

...

Additional arguments passed to fread.