get_pat_pos: Get position where search pattern occurs in a file

View source: R/odg_graphics.R

get_pat_posR Documentation

Get position where search pattern occurs in a file

Description

Given a search pattern and given a file that is specified by its complete path, the positions where the search pattern occurs is returned. Positions correspond to vector indices when the content of the file is read using the function readLines. These vector indices are equivalent to line numbers of the text. In case when the search pattern is not found, NA is returned.

Usage

get_pat_pos(ps_file, ps_pattern)

Arguments

ps_file

name of the file to search for pattern

ps_pattern

search pattern for which we search in the file

Value

vec_pos_found vector of positions where pattern occurs, NA if pattern was not found


charlotte-ngs/rmdhelp documentation built on Oct. 31, 2023, 10:21 a.m.