Skip to content

Commit

Permalink
#181 M3 fix ISOCodeListValues$values util
Browse files Browse the repository at this point in the history
  • Loading branch information
eblondel committed Oct 1, 2024
1 parent d506420 commit 958ffff
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion R/ISOCodeListValue.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,22 @@ ISOCodeListValue$values = function(class, labels = FALSE){
fields <- "value"
if(labels) fields <- c(fields, "name", "description")
element <- class$private_fields$xmlElement
if(is.list(element)){
if(getMetadataStandard() %in% names(element)){
element[[getMetadataStandard()]]
}else{
element[[1]]
}
}
if(element == "MD_ScopeCode") element <- "MX_ScopeCode"
return(getISOCodelist(element)$codeEntry[,fields])
cl = getISOCodelist(element)
out = sapply(cl$codeEntry, function(x){x$identifier$value})
if(labels){
out = data.frame(
out,
name = sapply(cl$codeEntry, function(x){x$description}),
description = sapply(cl$codeEntry, function(x){x$description})
)
}
return(out)
}

0 comments on commit 958ffff

Please sign in to comment.