Hi All,
This is my first post and I apologize in advance if this is a silly question.
So, I am exploring the beauties of purr
, and I am trying to load several packages using purr::walk
.
Here is what I am doing:
# SECTION: Load packages
c("DBI", "dplyr", "fs") |>
purrr::walk(.f = ~ require(package = .x, warn.conflicts = FALSE))
But I get an unforeseen result:
Loading required package: .x
Loading required package: .x
Loading required package: .x
I expected it would load each R package in the vector instead.
I also tried without using the pipe and it did not work either.
I REALLY can't get my head around it as I have, just before, used the exact same kind of construct to execute files en masse and it worked...
Here it is:
direxe <- function(thedir = "") {
glue::glue("{inilis$cmn}{thedir}/") |>
fs::dir_ls(type = "file", regexp = ".+\\.R$") |>
purrr::walk(.f = ~ source(.x))
}
Please help.
Thx,
Stephen