Skip to content

Commit

Permalink
fixed bug in indicator_metadata(IndicatorID = "All") --> Thanks Luke
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Fox committed Jan 20, 2021
1 parent 2b4a623 commit ee0655c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# fingertipsR 1.0.5.9000

* fixed warning message for multiple IndicatorIDs passed to indicator_metadata()
* fixed bug in indicator_metadata(IndicatorID = "All") - thanks Luke Bradley for pointing it out

# fingertipsR 1.0.5 (2020-09-16)

Expand Down
33 changes: 16 additions & 17 deletions R/indicator_metadata.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,31 @@ indicator_metadata <- function(IndicatorID = NULL,
if (!(is.null(IndicatorID))) {
AllIndicators <- indicators(path = path)

if (length(IndicatorID) == 1) {
if (IndicatorID == "All") {
if (identical(IndicatorID, "All")) {
dataurl <- paste0(path, "indicator_metadata/csv/all")
indicator_metadata <- dataurl %>%
GET(use_proxy(ie_get_proxy_for_url(.), username = "", password = "", auth = "ntlm")) %>%
content("parsed",
type = "text/csv",
encoding = "UTF-8",
col_types = types)
} else if (sum(AllIndicators$IndicatorID %in% IndicatorID) == 0){
stop("IndicatorID(s) do not exist, use indicators() to identify existing indicators")
}
} else if (sum(AllIndicators$IndicatorID %in% IndicatorID) == 0){

} else if (sum(AllIndicators$IndicatorID %in% IndicatorID) == 0) {
stop("IndicatorID(s) do not exist, use indicators() to identify existing indicators")
} else {
path <- paste0(path, "indicator_metadata/csv/by_indicator_id?indicator_ids=")
dataurl <- paste0(path,
paste(IndicatorID, collapse = "%2C"))
if (!(is.null(ProfileID)) & length(ProfileID == 1))
dataurl <- paste0(dataurl, "&profile_id=", ProfileID)
indicator_metadata <- dataurl %>%
GET(use_proxy(ie_get_proxy_for_url(.), username = "", password = "", auth = "ntlm")) %>%
content("parsed",
type = "text/csv",
encoding = "UTF-8",
col_types = types)
}
path <- paste0(path, "indicator_metadata/csv/by_indicator_id?indicator_ids=")
dataurl <- paste0(path,
paste(IndicatorID, collapse = "%2C"))
if (!(is.null(ProfileID)) & length(ProfileID == 1))
dataurl <- paste0(dataurl, "&profile_id=", ProfileID)
indicator_metadata <- dataurl %>%
GET(use_proxy(ie_get_proxy_for_url(.), username = "", password = "", auth = "ntlm")) %>%
content("parsed",
type = "text/csv",
encoding = "UTF-8",
col_types = types)

} else if (!(is.null(DomainID))) {
AllProfiles <- profiles(path = path)
if (sum(AllProfiles$DomainID %in% DomainID) == 0){
Expand Down

0 comments on commit ee0655c

Please sign in to comment.