Skip to content

Commit

Permalink
Warn, but return the default reference when the key-population combin…
Browse files Browse the repository at this point in the history
…ation is not found
  • Loading branch information
stefvanbuuren committed Aug 12, 2024
1 parent a0466e6 commit 56ab6d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/get_reference.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,11 @@ get_reference <- function(population = NULL,
# filter references
idx <- which(references$key == key & references$population == population)
if (!any(idx)) {
warning("Reference '", population, "' for key '", key, "' not found.",
# use default reference if not found
warning("Reference '", population, "' for key '", key, "' not found. Using default.",
call. = FALSE)
idx <- which(references$key == "gsed2406" &
references$population == "preliminary_standards")
}
return(references[idx, ])
}

0 comments on commit 56ab6d3

Please sign in to comment.