@@ -52,13 +52,13 @@ retrieveDictionary <- function(name) {
5252}
5353
5454saveDictionary <- function (name , dictionary ) {
55- # Save in the globals environment
55+ # Save in the globals environment
5656 assign(name , dictionary , globals )
5757
5858 # -------------------------------
5959 # 1️⃣ Save CRAN/GitHub-compliant copy (/data/)
6060 # -------------------------------
61- data_path <- file.path(system.file( package = " alspac " ), " data" )
61+ data_path <- file.path(getwd( ), " data" ) # always dev source tree
6262 if (! dir.exists(data_path )) dir.create(data_path , recursive = TRUE )
6363
6464 save(list = name ,
@@ -68,7 +68,7 @@ saveDictionary <- function(name, dictionary) {
6868 # -------------------------------
6969 # 2️⃣ Save dev copy (/inst/data/) for load_all() testing
7070 # -------------------------------
71- inst_path <- file.path(getwd(), " inst" , " data" ) # relative to project root
71+ inst_path <- file.path(getwd(), " inst" , " data" )
7272 if (! dir.exists(inst_path )) dir.create(inst_path , recursive = TRUE )
7373
7474 save(list = name ,
@@ -148,7 +148,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
148148 alspacdir <- options()$ alspac_data_dir
149149 datadir <- file.path(alspacdir , datadir )
150150
151- # --- NEW list.files section with version handling ---
151+ # ---list.files section with version handling ---
152152 files <- list.files(datadir ,
153153 pattern = " dta$" ,
154154 full.names = TRUE ,
@@ -163,7 +163,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
163163 num <- suppressWarnings(as.integer(sub(" ([0-9]+).*" , " \\ 1" , vers )))
164164 let <- sub(" [0-9]+" , " " , vers )
165165
166- # Build table of file info
166+ # Build table of file info
167167 file_info <- data.frame (
168168 file = files ,
169169 base = base ,
@@ -177,7 +177,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
177177 dplyr :: arrange(dplyr :: desc(num ), dplyr :: desc(let )) | >
178178 dplyr :: slice_head(n = 1 ) | >
179179 dplyr :: pull(file )
180- # --- END of new section ---
180+ # --- END of new section ---
181181
182182 dictionary <- parallel :: mclapply(latest_files , function (file ) {
183183 cat(date(), " loading" , file , " \n " )
@@ -202,7 +202,7 @@ createDictionary <- function(datadir="Current", name= "current", quick=FALSE, so
202202 # # Assign in globals so retrieveDictionary() can find it
203203 assign(name , dictionary , globals )
204204
205- # # Save using your robust saveDictionary() function
205+ # # Save using saveDictionary() function
206206 saveDictionary(name , dictionary )
207207
208208 invisible (dictionary )
0 commit comments