Skip to content

Commit 69af77d

Browse files
authored
Merge pull request #53 from cmu-delphi/ndefries/ext-names-no-ext-scores
When no external scores provided, make `external_options` empty
2 parents b146bb8 + e791985 commit 69af77d

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

run.R

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,21 @@ ensemble_options <- setNames(
111111

112112
external_options <- tar_read(external_names)
113113
EXTERNAL_PREFIX <- "[external] "
114-
external_options <- setNames(
115-
# File names
116-
# Get names of all branches of `external_scores` target by index. The way these
117-
# were specified, `external_names` provides the order of the branches.
118-
tar_branch_names(external_scores, seq_along(external_options)),
119-
# Display names
120-
paste0(
121-
EXTERNAL_PREFIX,
122-
gsub(" forecaster", "", gsub("_", " ", external_options, fixed = TRUE), fixed = TRUE)
114+
if (!is.null(external_options) && length(external_options) > 0) {
115+
external_options <- setNames(
116+
# File names
117+
# Get names of all branches of `external_scores` target by index. The way these
118+
# were specified, `external_names` provides the order of the branches.
119+
tar_branch_names(external_scores, seq_along(external_options)),
120+
# Display names
121+
paste0(
122+
EXTERNAL_PREFIX,
123+
gsub(" forecaster", "", gsub("_", " ", external_options, fixed = TRUE), fixed = TRUE)
124+
)
123125
)
124-
)
126+
} else {
127+
external_options <- character(0)
128+
}
125129

126130
forecaster_options <- c(ensemble_options, forecaster_options, external_options)
127131

0 commit comments

Comments
 (0)