Skip to content

Commit 997385a

Browse files
committed
fix access_level filter and add path provenance note
1 parent 0aec04d commit 997385a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

data-raw/make-data.R

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,12 @@ for (lvl in names(access_summary)) {
7777
}
7878

7979
# Keep only public records (access_level == 4)
80-
non_public <- sum(traitsview$access_level != 4, na.rm = TRUE)
80+
# Explicit NA check; rows with NA access_level are not public
81+
non_public <- sum(traitsview$access_level != 4 | is.na(traitsview$access_level))
8182
if (non_public > 0) {
82-
log_info(sprintf("Removing %d non-public records (access_level != 4)", non_public))
83-
traitsview <- traitsview[traitsview$access_level == 4, ]
83+
log_info(sprintf("Removing %d non-public records (access_level != 4 or NA)", non_public))
8484
}
85+
traitsview <- traitsview[traitsview$access_level == 4 & !is.na(traitsview$access_level), ]
8586

8687
# Drop access_level column (all remaining records are public)
8788
traitsview$access_level <- NULL
@@ -184,6 +185,10 @@ datasets <- c("traitsview", "species", "sites", "variables", "citations",
184185
"managements", "entities", "pfts_species", "pfts_priors",
185186
"managements_treatments", "cultivars_pfts")
186187

188+
# NOTE: paths are relative to the repo root, not installed package.
189+
# data-raw/ is excluded from the built package via .Rbuildignore.
190+
# These paths are for provenance, they point to the source CSVs
191+
# in the repository, not files shipped with installed package.
187192
resources <- lapply(datasets, function(nm) {
188193
df <- get(nm)
189194
base <- list(

0 commit comments

Comments
 (0)