Skip to content

Commit 6e7fba8

Browse files
committed
Merge branch 'master' of https://github.com/explodecomputer/alspac into update-dictionary-09102025
2 parents 27d8550 + f25ac74 commit 6e7fba8

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

R/dictionary.r

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,18 @@ retrieveDictionary <- function(name) {
5151
}
5252
}
5353

54+
5455
saveDictionary <- function(name, dictionary, overwrite = TRUE) {
5556
# Save in the globals environment
57+
5658
assign(name, dictionary, globals)
5759

5860
# -------------------------------
5961
# 1️⃣ Save CRAN/GitHub-compliant copy (/data/)
6062
# -------------------------------
63+
6164
data_path <- file.path(getwd(), "data")
65+
6266
if (!dir.exists(data_path)) dir.create(data_path, recursive = TRUE)
6367

6468
save(list = name,
@@ -69,7 +73,7 @@ saveDictionary <- function(name, dictionary, overwrite = TRUE) {
6973
# -------------------------------
7074
# 2️⃣ Save dev copy (/inst/data/) for load_all() testing
7175
# -------------------------------
72-
inst_path <- file.path(getwd(), "inst", "data") # relative to project root
76+
inst_path <- file.path(getwd(), "inst", "data")
7377
if (!dir.exists(inst_path)) dir.create(inst_path, recursive = TRUE)
7478

7579
save(list = name,
@@ -152,7 +156,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
152156
alspacdir <- options()$alspac_data_dir
153157
datadir <- file.path(alspacdir, datadir)
154158

155-
# --- NEW list.files section with version handling ---
159+
# ---list.files section with version handling ---
156160
files <- list.files(datadir,
157161
pattern="dta$",
158162
full.names=TRUE,
@@ -167,7 +171,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
167171
num <- suppressWarnings(as.integer(sub("([0-9]+).*", "\\1", vers)))
168172
let <- sub("[0-9]+", "", vers)
169173

170-
# Build table of file info
174+
# Build table of file info
171175
file_info <- data.frame(
172176
file = files,
173177
base = base,
@@ -181,7 +185,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
181185
dplyr::arrange(dplyr::desc(num), dplyr::desc(let)) |>
182186
dplyr::slice_head(n = 1) |>
183187
dplyr::pull(file)
184-
# --- END of new section ---
188+
# --- END of new section ---
185189

186190
dictionary <- parallel::mclapply(latest_files, function(file) {
187191
cat(date(), "loading", file, "\n")
@@ -206,7 +210,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
206210
## Assign in globals so retrieveDictionary() can find it
207211
assign(name, dictionary, globals)
208212

209-
## Save using your robust saveDictionary() function
213+
## Save using saveDictionary() function
210214
saveDictionary(name, dictionary)
211215

212216
invisible(dictionary)

data/current.rdata

1.52 MB
Binary file not shown.

0 commit comments

Comments
 (0)