Permalink
Browse files

Fixed a bunch of formatting issues with roxygen that was an error on …

…my part with the ST2 tool.
  • Loading branch information...
1 parent 8883f01 commit c2b9232135abff915822c7383f09abd3a39654c2 @karthik karthik committed Mar 22, 2012
Showing with 382 additions and 385 deletions.
  1. +10 −11 R/gbifdatause.R
  2. +33 −38 R/networks.r
  3. +46 −50 R/occurrencedensity.r
  4. +43 −39 R/occurrenceget.R
  5. +96 −88 R/occurrencelist.R
  6. +33 −38 R/providers.r
  7. +33 −37 R/resources.r
  8. +42 −36 R/taxoncount.R
  9. +37 −36 R/taxonsearch.R
  10. +9 −12 R/taxrank.r
View
@@ -1,11 +1,10 @@
-#' gbifdatause - description
-#' @import RCurl
-#' @param url Base url for call, don't change.
-#' @export
-#' @examples \dontrun{
-#' gbifdatause()
-#' }
-gbifdatause <- function(url = 'http://data.gbif.org/tutorial/datasharingagreement')
-{
- getURLContent(url)
-}
+#'gbifdatause - description
+#'@import RCurl
+#'@param url Base url for call, don't change.
+#'@export
+#'@examples \dontrun{
+#'gbifdatause()
+#'}
+gbifdatause <- function(url = "http://data.gbif.org/tutorial/datasharingagreement") {
+ getURLContent(url)
+}
View
@@ -1,40 +1,35 @@
-#' Get data networks and their unique keys.
-#'
-#' Beware: It takes a while to retrieve the full list of providers - so
-#' go get more coffee.
+#'Get data networks and their unique keys.
#'
-#' @import RCurl XML
-#' @param name data network name search string, by default searches all
-#' data networks by defining name = ""
-#' @param maxresults max number of results to return
-#' @param url the base GBIF API url for the function (should be left to default)
-#' @param ... optional additional curl options (debugging tools mostly)
-#' @param curl If using in a loop, call getCurlHandle() first and pass
-#' the returned value in here (avoids unnecessary footprint)
-#' @export
-#' @examples \dontrun{
-#' # Test the function for a few networks
-#' networks(maxresults=10)
+#'Beware: It takes a while to retrieve the full list of providers - so
+#'go get more coffee.
#'
-#' # All data providers
-#' networks()
-#' }
-networks <- function(name = "", maxresults = NA,
- url = "http://data.gbif.org/ws/rest/network/list",
- ...,
- curl = getCurlHandle())
-{
- args <- list()
- if(!is.na(name))
- args$name <- name
- if(!is.na(maxresults))
- args$maxresults <- maxresults
- out <- getForm(url,
- .params = args,
- ...,
- curl = curl)
- tt <- xmlParse(out)
- names_ <- xpathSApply(tt, "//gbif:resourceNetwork/gbif:name", xmlValue)
- gbifkey <- xpathSApply(tt, "//gbif:resourceNetwork", xmlAttrs)[1,]
- data.frame(names_, gbifkey)
-}
+#'@import RCurl XML
+#'@param name data network name search string, by default searches all
+#' data networks by defining name = ''
+#'@param maxresults max number of results to return
+#'@param url the base GBIF API url for the function (should be left to default)
+#'@param ... optional additional curl options (debugging tools mostly)
+#'@param curl If using in a loop, call getCurlHandle() first and pass
+#' the returned value in here (avoids unnecessary footprint)
+#'@export
+#'@examples \dontrun{
+#'# Test the function for a few networks
+#'networks(maxresults=10)
+#'#'# All data providers
+#'networks()
+#'}
+networks <- function(name = "", maxresults = NA, url = "http://data.gbif.org/ws/rest/network/list",
+ ..., curl = getCurlHandle()) {
+ args <- list()
+ if (!is.na(name))
+ args$name <- name
+ if (!is.na(maxresults))
+ args$maxresults <- maxresults
+ out <- getForm(url, .params = args, ..., curl = curl)
+ tt <- xmlParse(out)
+ names_ <- xpathSApply(tt, "//gbif:resourceNetwork/gbif:name",
+ xmlValue)
+ gbifkey <- xpathSApply(tt, "//gbif:resourceNetwork", xmlAttrs)[1,
+ ]
+ data.frame(names_, gbifkey)
+}
View
@@ -1,50 +1,46 @@
-#' returns summary counts of occurrence records by one-degree cell for a single
-#' taxon, country, dataset, data publisher or data network
-#' @import RCurl XML
-#' @param taxonconceptkey numeric key uniquely identifying the taxon
-#' @param dataproviderkey numeric key uniquely identifying the data provider
-#' @param dataresourcekey numeric key uniquely identifying the data resource
-#' @param resourcenetworkkey numeric key uniquely identifying the data network
-#' @param originisocountrycode numeric key uniquely identifying the country
-#' @param format specifies the format in which the records are to be returned,
-#' one of: brief, darwin or kml (character)
-#' @param url the base GBIF API url for the function (should be left to default)
-#' @param ... optional additional curl options (debugging tools mostly)
-#' @param curl If using in a loop, call getCurlHandle() first and pass
-#' the returned value in here (avoids unnecessary footprint)
-#' @export
-#' @examples \dontrun{
-#' occurrencedensity(originisocountrycode="CA")
-#' occurrencedensity(taxonconceptkey=45)
-#' }
-occurrencedensity <- function(taxonconceptkey = NA, dataproviderkey = NA,
- dataresourcekey = NA, resourcenetworkkey = NA, originisocountrycode = NA,
- format = NA, url = 'http://data.gbif.org/ws/rest/density/list', ...,
- curl = getCurlHandle())
-{
- args <- list()
- if(!is.na(taxonconceptkey))
- args$taxonconceptkey <- taxonconceptkey
- if(!is.na(dataproviderkey))
- args$dataproviderkey <- dataproviderkey
- if(!is.na(dataresourcekey))
- args$dataresourcekey <- dataresourcekey
- if(!is.na(resourcenetworkkey))
- args$resourcenetworkkey <- resourcenetworkkey
- if(!is.na(originisocountrycode))
- args$originisocountrycode <- originisocountrycode
- if(!is.na(format))
- args$format <- format
- out <- getForm(url,
- .params = args,
- ...,
- curl = curl)
- tt <- xmlParse(out)
- data.frame(cellid = xpathSApply(tt, "//gbif:densityRecord", xmlAttrs),
- minlat = xpathSApply(tt, "//gbif:densityRecord/gbif:minLatitude", xmlValue),
- maxlat = xpathSApply(tt, "//gbif:densityRecord/gbif:maxLatitude", xmlValue),
- minlong = xpathSApply(tt, "//gbif:densityRecord/gbif:minLongitude", xmlValue),
- maxlong = xpathSApply(tt, "//gbif:densityRecord/gbif:maxLongitude", xmlValue),
- count = xpathSApply(tt, "//gbif:densityRecord/gbif:count", xmlValue)
- )
-}
+#'returns summary counts of occurrence records by one-degree cell for a single
+#' taxon, country, dataset, data publisher or data network
+#'@import RCurl XML
+#'@param taxonconceptkey numeric key uniquely identifying the taxon
+#'@param dataproviderkey numeric key uniquely identifying the data provider
+#'@param dataresourcekey numeric key uniquely identifying the data resource
+#'@param resourcenetworkkey numeric key uniquely identifying the data network
+#'@param originisocountrycode numeric key uniquely identifying the country
+#'@param format specifies the format in which the records are to be returned,
+#' one of: brief, darwin or kml (character)
+#'@param url the base GBIF API url for the function (should be left to default)
+#'@param ... optional additional curl options (debugging tools mostly)
+#'@param curl If using in a loop, call getCurlHandle() first and pass
+#' the returned value in here (avoids unnecessary footprint)
+#'@export
+#'@examples \dontrun{
+#'occurrencedensity(originisocountrycode='CA')
+#'occurrencedensity(taxonconceptkey=45)
+#'}
+occurrencedensity <- function(taxonconceptkey = NA,
+ dataproviderkey = NA, dataresourcekey = NA, resourcenetworkkey = NA,
+ originisocountrycode = NA, format = NA, url = "http://data.gbif.org/ws/rest/density/list",
+ ..., curl = getCurlHandle()) {
+ args <- list()
+ if (!is.na(taxonconceptkey))
+ args$taxonconceptkey <- taxonconceptkey
+ if (!is.na(dataproviderkey))
+ args$dataproviderkey <- dataproviderkey
+ if (!is.na(dataresourcekey))
+ args$dataresourcekey <- dataresourcekey
+ if (!is.na(resourcenetworkkey))
+ args$resourcenetworkkey <- resourcenetworkkey
+ if (!is.na(originisocountrycode))
+ args$originisocountrycode <- originisocountrycode
+ if (!is.na(format))
+ args$format <- format
+ out <- getForm(url, .params = args, ..., curl = curl)
+ tt <- xmlParse(out)
+ data.frame(cellid = xpathSApply(tt, "//gbif:densityRecord",
+ xmlAttrs), minlat = xpathSApply(tt, "//gbif:densityRecord/gbif:minLatitude",
+ xmlValue), maxlat = xpathSApply(tt, "//gbif:densityRecord/gbif:maxLatitude",
+ xmlValue), minlong = xpathSApply(tt, "//gbif:densityRecord/gbif:minLongitude",
+ xmlValue), maxlong = xpathSApply(tt, "//gbif:densityRecord/gbif:maxLongitude",
+ xmlValue), count = xpathSApply(tt, "//gbif:densityRecord/gbif:count",
+ xmlValue))
+}
View
@@ -1,56 +1,60 @@
-#' occurrenceget - description
-#' @import RCurl XML
-#' @param key numeric key uniquely identifying the occurrence record within the GBIF
-#' @param format specifies the format in which the records are to be returned, one of: brief, darwin or kml (character)
-#' @param mode specifies whether the response data should (as far as possible) be the raw values originally retrieved from the data resource or processed (normalised) values used within the data portal (character)
-#' @param url the base GBIF API url for the function (should be left to default)
-#' @param ... optional additional curl options (debugging tools mostly)
-#' @param curl If using in a loop, call getCurlHandle() first and pass
-#' the returned value in here (avoids unnecessary footprint)
-#' @export
-#' @examples \dontrun{
-#' occurrenceget(key = 13749100)
-#' }
+#'occurrenceget - description
+#'@import RCurl XML
+#'@param key numeric key uniquely identifying the occurrence record within the GBIF
+#'@param format specifies the format in which the records are to be returned, one of: brief, darwin or kml (character)
+#'@param mode specifies whether the response data should (as far as possible) be the raw values originally retrieved from the data resource or processed (normalised) values used within the data portal (character)
+#'@param url the base GBIF API url for the function (should be left to default)
+#'@param ... optional additional curl options (debugging tools mostly)
+#'@param curl If using in a loop, call getCurlHandle() first and pass
+#' the returned value in here (avoids unnecessary footprint)
+#'@export
+#'@examples \dontrun{
+#'occurrenceget(key = 13749100)
+#'}
occurrenceget <- function(key = NA, format = NA, mode = NA,
- url = 'http://data.gbif.org/ws/rest/occurrence/get?',
- ...,
- curl = getCurlHandle())
-{
- if(!is.na(key)) {key2 <- paste('key=', key, sep='')} else
- {key2 <- NULL}
- if(!is.na(format)) {format2 <- paste('format=', format, sep='')} else
- {format2 <- NULL}
- if(!is.na(mode)) {mode2 <- paste('mode=', mode, sep='')} else
- {mode2 <- NULL}
- args <- paste(key2, format2, mode2, sep='&')
- query <- paste(url, args, sep='')
- tt <- getURL(query,
- ...,
- curl = curl)
- xmlTreeParse(tt)$doc$children$gbifResponse
+ url = "http://data.gbif.org/ws/rest/occurrence/get?", ...,
+ curl = getCurlHandle()) {
+ if (!is.na(key)) {
+ key2 <- paste("key=", key, sep = "")
+ } else {
+ key2 <- NULL
+ }
+ if (!is.na(format)) {
+ format2 <- paste("format=", format, sep = "")
+ } else {
+ format2 <- NULL
+ }
+ if (!is.na(mode)) {
+ mode2 <- paste("mode=", mode, sep = "")
+ } else {
+ mode2 <- NULL
+ }
+ args <- paste(key2, format2, mode2, sep = "&")
+ query <- paste(url, args, sep = "")
+ tt <- getURL(query, ..., curl = curl)
+ xmlTreeParse(tt)$doc$children$gbifResponse
}
-
# tt <- occurrenceget(key = 13850822)
# tt_ <- xmlTreeParse(tt)
# xmlTreeParse(tt_)
# getNodeSet
-#
+#
# #
-#
-#
+#
+#
# if(!is.null(sciname)) {
-# sciname2 <- paste("scientificname=", sub(" ", "+", sciname), sep = "")} else
+# sciname2 <- paste('scientificname=', sub(' ', '+', sciname), sep = '')} else
# {sciname2 <- NULL}
# if(!is.null(rank)){
-# rank2 <- paste("rank=", rank, sep = "")} else
+# rank2 <- paste('rank=', rank, sep = '')} else
# {rank2 <- NULL}
# if(!is.null(datakey)){
-# datakey2 <- paste("dataresourcekey=", datakey, sep = "")} else
+# datakey2 <- paste('dataresourcekey=', datakey, sep = '')} else
# {datakey2 <- NULL}
-# args <- paste(sciname2, rank2, datakey2, sep = "&")
-# url2 <- paste(url, args, sep = "")
+# args <- paste(sciname2, rank2, datakey2, sep = '&')
+# url2 <- paste(url, args, sep = '')
# tt <- getURLContent(url2)
# out <- xmlTreeParse(tt)$doc$children$gbifResponse
# out2 <- as.numeric(xmlToList(out)[[8]])
# return(out2)
-# }
+# }
Oops, something went wrong.

0 comments on commit c2b9232

Please sign in to comment.