Inventories the programs in a directory for the "programs submitted" section of a Reviewer's Guide: file name, path relative to path, size, last-modified time, and the program's leading comment/header block as its description where one is present.

section_programs(path, pattern = NULL)

Arguments

path

Directory containing the submitted programs.

pattern

Optional regular expression passed to list.files() to select program files. Defaults to R and SAS program files ("\\.(R|r|sas|SAS)$").

Value

A tibble with columns file, path, size, modified, description, one row per matching program.

How the description is read

description is not parsed from the program's code. It is the leading comment block only, read with a deliberately simple heuristic:

  • a /* ... */ block starting on line 1 (SAS), or

  • consecutive leading comment lines starting # (R) or * (SAS),

  • within the first 60 lines of the file, collapsed to one line and truncated at 300 characters.

Consequently: a program whose header sits below a licence banner or an options/library block gets NA; a header that lies (stale copy-paste) is reported verbatim; and the inputs, outputs and macros a program actually uses are never inspected. Treat description as the programmer's own header text, and read it before shipping the guide. Writing a real R/SAS parser was judged not worth it: submission programs already carry standard headers, and a wrong parse is worse than an honest NA. Pass a corrected description column downstream if you need better.

Examples

progs <- system.file("extdata", "programs", package = "reviewerguider")
section_programs(progs)
#> # A tibble: 2 × 5
#>   file     path     size  modified            description                       
#>   <chr>    <chr>    <chr> <dttm>              <chr>                             
#> 1 adsl.R   adsl.R   231 B 2026-08-02 21:23:44 Program: adsl.R Purpose: Derive t…
#> 2 t_dm.sas t_dm.sas 211 B 2026-08-02 21:23:45 Program: t_dm.sas Purpose: Produc…