att_from_rscripts: Look for functions called with '::' and library/requires in...

View source: R/att_from_rscripts.R

att_from_rscriptsR Documentation

Look for functions called with :: and library/requires in folder of scripts

Description

Look for functions called with :: and library/requires in folder of scripts

Usage

att_from_rscripts(
  path = "R",
  pattern = "*.[.](r|R)$",
  recursive = TRUE,
  folder_to_exclude = "renv",
  encoding = getOption("encoding")
)

Arguments

path

directory with R scripts inside or vector of R scripts

pattern

pattern to detect R script files

recursive

logical. Should the listing recurse into directories?

folder_to_exclude

Folder to exclude during scan to detect packages. 'renv' by default.

encoding

Encoding passed to readLines() when reading path. Defaults to getOption("encoding") so the system locale is respected (important on Windows where scripts are often Latin-1 / Windows-1252).

Value

vector of character of packages names found in the R script

Examples

dummypackage <- system.file("dummypackage",package = "attachment")
# browseURL(dummypackage)

att_from_rscripts(path = file.path(dummypackage, "R"))
att_from_rscripts(path = list.files(file.path(dummypackage, "R"), full.names = TRUE))

attachment documentation built on April 25, 2026, 9:06 a.m.