Learn R Programming

findInFiles (version 0.4.0)

findInFiles: Find pattern in files

Description

Find a pattern in some files.

Usage

findInFiles(
  ext,
  pattern,
  depth = NULL,
  wholeWord = FALSE,
  ignoreCase = FALSE,
  perl = FALSE,
  excludePattern = NULL,
  excludeFoldersPattern = NULL,
  root = ".",
  output = "viewer"
)

Arguments

ext

file extension, e.g. "R" or "js"

pattern

pattern to search for, a regular expression, e.g. "function" or "^function"

depth

depth of the search, NULL or a negative number for an entire recursive search (subdirectories, subdirectories of subdirectories, etc.), otherwise a positive integer: 0 to search in the root directory only, 1 to search in the root directory and its subdirectories, etc.

wholeWord

logical, whether to match the whole pattern

ignoreCase

logical, whether to ignore the case

perl

logical, whether pattern is a Perl regular expression

excludePattern

a pattern; exclude from search the files and folders which match this pattern

excludeFoldersPattern

a pattern; exclude from search the folders which match this pattern

root

path to the root directory to search from

output

one of "viewer", "tibble" or "viewer+tibble"; see examples

Value

A tibble if output="tibble", otherwise a htmlwidget object.

Examples

Run this code
# NOT RUN {
library(findInFiles)
folder <- system.file("example", package = "findInFiles")
findInFiles("R", "function", root = folder)

findInFiles("R", "function", root = folder, output = "tibble")

fif <- findInFiles("R", "function", root = folder, output = "viewer+tibble")
FIF2tibble(fif)
FIF2dataframe(fif)
fif

folder <- system.file("www", "shared", package = "shiny")
findInFiles("css", "outline", excludePattern = "*.min.css", root = folder)
# }

Run the code above in your browser using DataLab