search_text: Search for text in R files

Description Usage Arguments Examples

Description

This function searches for text in text files with (by default) R and Rmd extension.

Usage

1
2
search_text(string, dir = ".", extension = c("R", "Rmd"), pattern = NULL,
  fixed = FALSE, ignore.case = TRUE, deep = FALSE)

Arguments

string

text string to search for. If fixed = FALSE (the default), regular expressions may be used

dir

directory (by default, the working directory)

extension

file extension of files to search, by default .R and .Rmd

pattern

if you want to search for files with a particular name (takes presedence over extension)

fixed

if TRUE, the literal string will be searched for; if FALSE (the default), regular expressions may be used (see ?grep)

ignore.case

if TRUE (default), character case will be ignored (i.e., if you search for "Md" the function will search for "md", "mD" and "MD" as well)

deep

if TRUE, it will also search in subdirectories

Examples

1
2
3
4
search_text("Mod. 1")
search_text("image.plot(", "H:/Documents/seksjon 214/2015_01_FjordBloom/Analyser", fixed = TRUE, deep = TRUE)
# Use fixed = TRUE when the search text contains e.g. parantheses:
search_text("save(", fixed = TRUE)

DagHjermann/rmann documentation built on May 14, 2019, 5:15 a.m.