-
Notifications
You must be signed in to change notification settings - Fork 4
/
shims.R
40 lines (34 loc) · 877 Bytes
/
shims.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#' Shims for common input/output functions
#' @export
#' @param file The path
#' @param ... arguments passed to functions
#' @importFrom fs file_exists
#' @importFrom readr read_csv
#' @importFrom conflicted conflict_prefer
#' @seealso \code{\link[readr]{read_csv}}
#' @examples
#' \dontrun{
#' if (require(readr)) {
#' read_csv(tempfile())
#' }
#' }
read_csv <- function(file, ...) {
# conflicted::conflict_prefer("read_csv", "fertile")
log_push(file, "read_csv")
checks(file)
readr::read_csv(file, ...)
}
#' @rdname read_csv
#' @inheritParams base::setwd
#' @export
setwd <- function(dir) {
stop("setwd() is likely to break reproducibility. Use here::here() instead.")
}
#' @rdname read_csv
#' @export
source <- function(file, ...) {
# conflicted::conflict_prefer("read_csv", "fertile")
log_push(file, "source")
checks(file)
base::source(file, ...)
}