File: utils.R

package info (click to toggle)
r-cran-readxl 0.1.1-1%2Bdeb9u2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,512 kB
  • sloc: ansic: 4,419; cpp: 2,702; makefile: 1
file content (17 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
check_file <- function(path) {
  if (!file.exists(path)) {
    stop("'", path, "' does not exist",
      if (!is_absolute_path(path))
        paste0(" in current working directory ('", getwd(), "')"),
      ".",
      call. = FALSE)
  }

  normalizePath(path, "/", mustWork = FALSE)
}

is_absolute_path <- function(path) {
  grepl("^(/|[A-Za-z]:|\\\\|~)", path)
}

isFALSE <- function(x) identical(x, FALSE)