Skip to content

Commit 3420c8b

Browse files
committed
finalize sketch of read_clean() add tests + fix tests for na_if2
1 parent 346c55a commit 3420c8b

File tree

3 files changed

+248
-217
lines changed

3 files changed

+248
-217
lines changed

R/read.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#'
1414
read_clean <- function(file, ...) {
1515
file_ext <- fs::path_ext(file)
16-
rlang::check_installed(c("labelled", "readr", "readxl", "janitor"))
16+
rlang::check_installed(c("readr", "readxl"))
1717
f <- switch(
1818
file_ext,
1919
"csv" = readr::read_csv,
@@ -25,9 +25,12 @@ read_clean <- function(file, ...) {
2525
dat <- f(file, ...)
2626
labels <- names(dat)
2727

28+
rlang::check_installed("janitor")
2829
dat <- janitor::clean_names(dat)
2930

3031
if (!identical(names(dat), labels)) {
32+
# TODO inline this..
33+
rlang::check_installed("labelled")
3134
dat <- labelled::set_variable_labels(dat, .labels = labels)
3235
}
3336

0 commit comments

Comments
 (0)