File: utils.R

package info (click to toggle)
r-cran-rprojroot 2.0.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 496 kB
  • sloc: sh: 12; makefile: 7
file content (15 lines) | stat: -rw-r--r-- 358 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
list_files <- function(path, filename) {
  files <- dir(path = path, pattern = filename, all.files = TRUE, full.names = TRUE)
  dirs <- dir.exists(files)
  files <- files[!dirs]
  files
}

match_contents <- function(f, contents, n, fixed) {
  if (is.null(contents)) {
    return(TRUE)
  }

  fc <- readLines(f, n)
  any(grepl(contents, fc, fixed = fixed))
}