-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
completed matching functions to webservice
- Loading branch information
1 parent
a0a332d
commit d91e2ba
Showing
9 changed files
with
146 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#' Get List of Details | ||
#' | ||
#' Retrieves all the details for the given code. | ||
#' | ||
#' @param code_type the code type, e.g. SpecWoRMS | ||
#' @param code the code, e.g. 101170 | ||
#' | ||
#' @return A data frame. | ||
#' | ||
#' @examples | ||
#' # get the details for species code 101170 | ||
#' getCodeDetail("SpecWoRMS", "101170") | ||
#' | ||
#' @export | ||
getCodeDetail <- function(code_type, code) { | ||
|
||
# base url | ||
url <- sprintf("http://vocab.ices.dk/services/pox/GetCodeDetail/%s/%s", code_type, code) | ||
|
||
# read and parse XML from API | ||
out <- curlVocab(url = url) | ||
# parse the xml text string suppplied by the Datras webservice | ||
# returning a dataframe | ||
out <- parseVocab(out) | ||
|
||
# for now, drop parent relation... | ||
out <- out[names(out) != "ParentRelation"] | ||
|
||
# return | ||
out | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#' Get List of Code Types | ||
#' | ||
#' Retrieves all the codes types. | ||
#' | ||
#' @param date restrict output to code types | ||
#' modified after the given date. | ||
#' date should be text and in the fomat "yyyy-mm-dd", e.g. "2010-12-01" | ||
#' | ||
#' @return A data frame. | ||
#' | ||
#' @examples | ||
#' codes <- getCodeTypeList() | ||
#' codes[grep("worms", tolower(codes$Description)),] | ||
#' | ||
#' @export | ||
getCodeTypeList <- function(date=NULL) { | ||
|
||
# base url | ||
url <- "http://vocab.ices.dk/services/pox/GetCodeTypeList" | ||
|
||
# if date supplied return list of code types modified after the given date | ||
if (!is.null(date)) { | ||
url <- sprintf(paste0(url, "/%s"), date) | ||
} | ||
|
||
# read and parse XML from API | ||
out <- curlVocab(url = url) | ||
# parse the xml text string suppplied by the Datras webservice | ||
# returning a dataframe | ||
out <- parseVocab(out) | ||
|
||
# return | ||
out | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.