display_selected_code_comments: Displays selected comments

View source: R/display_selected_code_comments.R

display_selected_code_commentsR Documentation

Displays selected comments

Description

Displays selected comments

Usage

display_selected_code_comments(path = ".", pattern = NULL, label = "")

Arguments

path

a character vector of full path names; the default corresponds to the working directory, getwd(). Tilde expansion (see path.expand) is performed. Missing values will be ignored. Elements with a marked encoding will be converted to the native encoding (and if that fails, considered non-existent). Defaults to ".".

pattern

an optional regular expression. Only file names which match the regular expression will be returned.

label

Optional regex expression that can be used to limit the comments found by adding each element of the character vector in turn immediately after "<!–" in the regex expression. The resulting logical vectors are OR'd together to combine their results.

Value

Dataframe of selected comments with the base file name, the comment label, the comment start line, and the comment text.

Internally uses the list.files function with the path and pattern arguments as defined in the call. Other arguments to list.files are forced as follows:

all.files

TRUE

full.names

TRUE

recursive

TRUE

ignore.case

TRUE

include.dirs

FALSE

no..

FALSE

The user is free to create the list of files anyway desired and provide them to the path argument.

Examples

files = system.file("testdata", "find_html_comment_test_file_1.Rmd",
                    package = "rmsutilityr")
display_selected_code_comments(path = dirname(files),
                                         pattern = "Rmd",
                                         label = "RMS")


rmsharp/rmsutilityr documentation built on Feb. 13, 2024, 6:01 p.m.