-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_targets.R
40 lines (31 loc) · 990 Bytes
/
_targets.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
library(targets)
library(tarchetypes)
library(qs)
options(tidyverse.quiet = TRUE, dplyr.summarise.inform = FALSE)
# attach R packages
required_packages <- read.delim("R/packages", header = FALSE, col.names = "name")$name
tar_option_set(packages = required_packages, format = "qs")
# Create dirs if necessary
for (d in c("tab", "fig", "cache")) if (!dir.exists(d)) dir.create(d)
# for interactive session only
if (interactive()) sapply(required_packages, library, character.only = TRUE)
# load all functions from .R files
files_R <- list.files(c("R", "targets"), pattern = "*.R$", full.names = TRUE)
sr_ <- sapply(files_R, source)
# prevent other packages from stealing from tidyverse
filter <- dplyr::filter
rename <- dplyr::rename
select <- dplyr::select
# Add session info
sesinfo <- list(
tar_target(session_info, sessionInfo())
)
# Targets
c(
sesinfo,
targets_data(),
targets_differential_abundance(),
targets_profiles(),
targets_report(),
targets_manuscript()
)