From cc1a812ebcaae302d6402243e7c06cfff973df12 Mon Sep 17 00:00:00 2001 From: Scott Chamberlain Date: Tue, 10 Oct 2017 16:23:20 -0700 Subject: [PATCH] fix #62 (see also #61) put dwc terms inside of pkg to avoid breaking pkg when file moves on the web --- DESCRIPTION | 2 +- NEWS.md | 12 ++- R/vert_id.R | 13 ++- R/zzz.R | 8 +- cran-comments.md | 7 +- inst/extdata/simple_dwc_terms.txt | 169 ++++++++++++++++++++++++++++++ man/vert_id.Rd | 11 +- 7 files changed, 207 insertions(+), 15 deletions(-) create mode 100644 inst/extdata/simple_dwc_terms.txt diff --git a/DESCRIPTION b/DESCRIPTION index 0a53ef8..e7b5c43 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -4,7 +4,7 @@ Description: Retrieve, map and summarize data from the 'VertNet.org' archives. Functions allow searching by many parameters, including 'taxonomic' names, places, and dates. In addition, there is an interface for conducting spatially delimited searches, and another for requesting large 'datasets' via email. -Version: 0.6.0.9100 +Version: 0.6.2 Author: Scott Chamberlain [aut, cre], Chris Ray [aut], Vijay Barve [aut] Maintainer: Scott Chamberlain License: MIT + file LICENSE diff --git a/NEWS.md b/NEWS.md index 1e5d3b4..098f370 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,13 @@ +rvertnet 0.6.2 +=============== + +### BUG FIXES + +* A small data source used in one function was on the web, and +was moved - that data source now within the pkg as quite small, and +now pkg won't break when the file is moved again (#61) (#62) + + rvertnet 0.6.0 =============== @@ -24,7 +34,7 @@ allows to optionally only return Darwin Core fields ### BUG FIXES -* Small fix to `vertsummary()` (59) +* Small fix to `vertsummary()` (#59) rvertnet 0.5.0 diff --git a/R/vert_id.R b/R/vert_id.R index 76859df..cf3c3a1 100644 --- a/R/vert_id.R +++ b/R/vert_id.R @@ -11,7 +11,15 @@ #' @return A list, with data frame of search results, and list of metadata #' @references \url{http://bit.ly/vertnet-wiki} #' @details VertNet IDs can be a variety of things, some URIs -#' (i.e., with http://...), while others start with \code{urn}. +#' (i.e., with http://...), while others start with \code{urn}. +#' +#' Internally in this function we filter data to darwin core terms only. To +#' see what terms we use, do +#' \code{readLines( +#' system.file("extdata", "simple_dwc_terms.txt", package = "rvertnet"))}. +#' Get in touch with us if these terms need correcting/are out of date. The +#' terms are from +#' https://github.com/tdwg/dwc/blob/master/dist/simple_dwc_horizontal.csv #' #' @examples \dontrun{ #' vert_id(ids = "urn:catalog:CM:Herps:116520") @@ -21,8 +29,7 @@ #' res <- vert_id(ids) #' res$data$occurrenceid #' -#' # Lots -#' out <- vertsearch(taxon = "aves", state = "california", limit = 20) +#' out <- vertsearch(taxon = "aves", state = "california", limit = 5) #' (ids <- out$data$occurrenceid) #' res <- vert_id(ids) #' identical(sort(res$data$occurrenceid), sort(ids)) diff --git a/R/zzz.R b/R/zzz.R index df7d373..2895777 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -34,10 +34,10 @@ vertwrapper <- function(fxn = "", args = NULL, lim = NULL, rfile = NULL, mssg <- function(v, ...) if (v) message(...) -get_terms <- function(){ - url <- "https://raw.githubusercontent.com/tdwg/dwc/master/dist/simple_dwc_horizontal.csv" - res <- crul::HttpClient$new(url)$get()$parse("UTF-8") - tolower(strsplit(res, split = ",")[[1]]) +get_terms <- function() { + readLines( + system.file("extdata", "simple_dwc_terms.txt", package = "rvertnet") + ) } vert_GET <- function(fxn="searchbyterm", args, limit = 1000, messages = TRUE, diff --git a/cran-comments.md b/cran-comments.md index 5efd2e1..265c76e 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,7 +1,7 @@ ## Test environments -* local OS X install, R 3.4.1 patched -* ubuntu 12.04 (on travis-ci), R 3.4.1 +* local OS X install, R 3.4.2 patched +* ubuntu 12.04 (on travis-ci), R 3.4.2 * win-builder (devel and release) ## R CMD check results @@ -22,8 +22,7 @@ -------- -This release includes a new function, swaps a dependency, and some minor -changes and bug fixes. +This release includes a bug fix for a data source that moved on the web. Sincerely, Scott Chamberlain diff --git a/inst/extdata/simple_dwc_terms.txt b/inst/extdata/simple_dwc_terms.txt new file mode 100644 index 0000000..05cf817 --- /dev/null +++ b/inst/extdata/simple_dwc_terms.txt @@ -0,0 +1,169 @@ +type +modified +language +license +rightsholder +accessrights +bibliographiccitation +references +institutionid +collectionid +datasetid +institutioncode +collectioncode +datasetname +ownerinstitutioncode +basisofrecord +informationwithheld +datageneralizations +dynamicproperties +occurrenceid +catalognumber +recordnumber +recordedby +individualcount +organismquantity +organismquantitytype +sex +lifestage +reproductivecondition +behavior +establishmentmeans +occurrencestatus +preparations +disposition +associatedmedia +associatedreferences +associatedsequences +associatedtaxa +othercatalognumbers +occurrenceremarks +organismid +organismname +organismscope +associatedoccurrences +associatedorganisms +previousidentifications +organismremarks +materialsampleid +eventid +parenteventid +fieldnumber +eventdate +eventtime +startdayofyear +enddayofyear +year +month +day +verbatimeventdate +habitat +samplingprotocol +samplesizevalue +samplesizeunit +samplingeffort +fieldnotes +eventremarks +locationid +highergeographyid +highergeography +continent +waterbody +islandgroup +island +country +countrycode +stateprovince +county +municipality +locality +verbatimlocality +minimumelevationinmeters +maximumelevationinmeters +verbatimelevation +minimumdepthinmeters +maximumdepthinmeters +verbatimdepth +minimumdistanceabovesurfaceinmeters +maximumdistanceabovesurfaceinmeters +locationaccordingto +locationremarks +decimallatitude +decimallongitude +geodeticdatum +coordinateuncertaintyinmeters +coordinateprecision +pointradiusspatialfit +verbatimcoordinates +verbatimlatitude +verbatimlongitude +verbatimcoordinatesystem +verbatimsrs +footprintwkt +footprintsrs +footprintspatialfit +georeferencedby +georeferenceddate +georeferenceprotocol +georeferencesources +georeferenceverificationstatus +georeferenceremarks +geologicalcontextid +earliesteonorlowesteonothem +latesteonorhighesteonothem +earliesteraorlowesterathem +latesteraorhighesterathem +earliestperiodorlowestsystem +latestperiodorhighestsystem +earliestepochorlowestseries +latestepochorhighestseries +earliestageorloweststage +latestageorhigheststage +lowestbiostratigraphiczone +highestbiostratigraphiczone +lithostratigraphicterms +group +formation +member +bed +identificationid +identificationqualifier +typestatus +identifiedby +dateidentified +identificationreferences +identificationverificationstatus +identificationremarks +taxonid +scientificnameid +acceptednameusageid +parentnameusageid +originalnameusageid +nameaccordingtoid +namepublishedinid +taxonconceptid +scientificname +acceptednameusage +parentnameusage +originalnameusage +nameaccordingto +namepublishedin +namepublishedinyear +higherclassification +kingdom +phylum +class +order +family +genus +subgenus +specificepithet +infraspecificepithet +taxonrank +verbatimtaxonrank +scientificnameauthorship +vernacularname +nomenclaturalcode +taxonomicstatus +nomenclaturalstatus +taxonremarks diff --git a/man/vert_id.Rd b/man/vert_id.Rd index b7a7c40..2845726 100644 --- a/man/vert_id.Rd +++ b/man/vert_id.Rd @@ -26,6 +26,14 @@ Search by Vertnet occurrence ID \details{ VertNet IDs can be a variety of things, some URIs (i.e., with http://...), while others start with \code{urn}. + +Internally in this function we filter data to darwin core terms only. To +see what terms we use, do +\code{readLines( +system.file("extdata", "simple_dwc_terms.txt", package = "rvertnet"))}. +Get in touch with us if these terms need correcting/are out of date. The +terms are from +https://github.com/tdwg/dwc/blob/master/dist/simple_dwc_horizontal.csv } \examples{ \dontrun{ @@ -36,8 +44,7 @@ ids <- c("http://arctos.database.museum/guid/MSB:Mamm:56979?seid=1643089", res <- vert_id(ids) res$data$occurrenceid -# Lots -out <- vertsearch(taxon = "aves", state = "california", limit = 20) +out <- vertsearch(taxon = "aves", state = "california", limit = 5) (ids <- out$data$occurrenceid) res <- vert_id(ids) identical(sort(res$data$occurrenceid), sort(ids))