Skip to content

Commit

Permalink
Fix get_NASIS_metadata() on devices without local NASIS
Browse files Browse the repository at this point in the history
  • Loading branch information
brownag committed Jun 29, 2022
1 parent f861a1f commit ca38f37
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions R/uncode.R
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ NASISDomainsAsFactor <- function(x = NULL) {
#' get_NASIS_metadata()
get_NASIS_metadata <- function(dsn = NULL) {

metadata <- NULL

.doQuery <- function(dsn){
q <- "SELECT mdd.DomainID, DomainName, DomainRanked, DisplayLabel,
ChoiceSequence, ChoiceValue, ChoiceName, ChoiceLabel, ChoiceObsolete,
Expand Down Expand Up @@ -231,10 +233,13 @@ get_NASIS_metadata <- function(dsn = NULL) {
metadata <- get("NASIS.metadata", envir = soilDB.env)
}

} else {
}

if (is.null(metadata) || (is.data.frame(metadata) && nrow(metadata) == 0)) {
load(system.file("data/metadata.rda", package = "soilDB")[1])
}


metadata
}

#' Get NASIS metadata entries for specific domains or choices
Expand Down

0 comments on commit ca38f37

Please sign in to comment.