This repository has been archived by the owner on Nov 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path01-design.R
83 lines (68 loc) · 3.04 KB
/
01-design.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
message(timestamp(quiet = TRUE))
### Project Setup ==================================================================================
library(here)
project_name <- sub("(.*)_*\\..*", "\\1", list.files(here(), pattern = ".Rproj$"))
output_directory <- here("outputs", "01-design")
dir.create(output_directory, recursive = TRUE, showWarnings = FALSE, mode = "0775")
### Load Packages ==================================================================================
suppressPackageStartupMessages({
# library(ragg)
# library(ggplot2)
# library(ggtext)
# library(patchwork)
# library(data.table)
})
### Tables and Figures Theme =======================================================================
# options(
# ggplot2.discrete.colour = function(...) scale_colour_viridis_d(..., begin = 0.15, end = 0.85),
# ggplot2.discrete.fill = function(...) scale_fill_viridis_d(..., begin = 0.15, end = 0.85),
# ggplot2.continuous.colour = function(...) scale_colour_viridis_c(..., begin = 0.15, end = 0.85),
# ggplot2.continuous.fill = function(...) scale_fill_viridis_c(..., begin = 0.15, end = 0.85)
# )
# theme_set(theme_minimal(base_family = "Tex Gyre Termes"))
# theme_update(
# plot.title.position = "plot",
# plot.caption.position = "plot",
# plot.title = element_markdown(),
# plot.subtitle = element_markdown(face = "italic", size = rel(0.80)),
# plot.caption = element_markdown(face = "italic", size = rel(0.65)),
# axis.title.x = element_markdown(),
# axis.text.x = element_markdown(),
# axis.title.y = element_markdown(),
# axis.text.y = element_markdown()
# )
### Functions ======================================================================================
### Analysis =======================================================================================
# Work in progress ...
### Archive ========================================================================================
# if (!Sys.getenv("USER") %in% c("root", "") && file.exists("~/.fex/id")) {
# local({
# owd <- getwd()
# setwd(normalizePath(output_directory))
# archive_name <- file.path(
# normalizePath(output_directory),
# paste0(
# format(Sys.Date(), format = "%Y%m%d"), "_",
# project_name, "_",
# gsub("[0-9]+\\-", "", basename(output_directory)), ".zip"
# )
# )
# zip(archive_name, files = list.files())
# fex_out <- system(paste("fexsend", archive_name, "."), intern = TRUE)
# unlink(archive_name)
# setwd(owd)
# })
# }
### Set chmod ======================================================================================
Sys.chmod(
list.files(output_directory, full.names = TRUE),
mode = "0775", use_umask = FALSE
)
Sys.chmod(
list.files(output_directory, full.names = TRUE, recursive = TRUE, all.files = TRUE),
mode = "0775", use_umask = FALSE
)
invisible(system(paste("chgrp -R staff", output_directory), intern = TRUE))
### Complete =======================================================================================
message("Success!", appendLF = TRUE)
message(timestamp(quiet = TRUE))