Learn R Programming

funspotr (version 0.0.5)

str_detect_r_docs: String Detect R or Rmarkdown or Quarto File endings

Description

Wrapper on stringr::str_detect() to return TRUE for only R and Rmarkdown or Quarto files, else FALSE.

Usage

str_detect_r_docs(
  contents,
  pattern = stringr::regex("(r|rmd|rmarkdown|qmd)$", ignore_case = TRUE),
  rmv_index = TRUE
)

Value

Logical vector.

Arguments

contents

Character vector of file path.

pattern

Regex pattern to identify file types.

rmv_index

Logical, default to TRUE, most repos containing blogdown sites will have an index.R file at the root. Change to FALSE if you don't want this file removed.

Examples

Run this code
files <- c("file1.R", "file2.Rmd", "file3.Rmarkdown", "file4.Rproj", "file5.qmd")
funspotr::str_detect_r_docs(files)

Run the code above in your browser using DataLab