This package has been archived. The former README is now in README-not.
ropensci-archive / antweb Goto Github PK
View Code? Open in Web Editor NEW:warning: ARCHIVED :warning: An R wrapper for the AntWeb API
:warning: ARCHIVED :warning: An R wrapper for the AntWeb API
This package has been archived. The former README is now in README-not.
v2
. I guess this needs to be ported over.@jaymollica: Could you port these over as well? Then we can fully switch over to the new API. Otherwise new release is looking good. Nice work!
Using stop_for_status()
in aw_data()
. Change to warn instead, and make sure this works smoothly in spocc
to allow searches to proceed even if some sources fail
related to ropensci/spocc#53
Greetings
I've been trying to retrieve AntWeb data using aw_data, but keep getting a fromJSON and an HTTP 404 error:
Example
data <- aw_data(genus = 'Strumigenys', species = 'cultrigera')
Execution and error
data <- aw_data(genus = 'Strumigenys', species = 'cultrigera')`
Error in fromJSON(content(results, "text")) : unexpected character '<'
In addition: Warning message:
In aw_data(genus = "Strumigenys", species = "cultrigera") :
Not Found (HTTP 404).
I believe that the function is trying to use the base_url of a deprecated API version to query data.
System Info
$ platform "x86_64-w64-mingw32"
$ arch "x86_64"
$ os "mingw32"
$ system "x86_64, mingw32"
$ status ""
$ major "3"
$ minor "6.0"
$ year "2019"
$ month "04"
$ day "26"
$ svn rev "76424"
$ language "R"
$ version.string"R version 3.6.0 (2019-04-26)"
$ nickname "Planting of a Tree"
Package Info
Package: AntWeb
Version: 0.7
Depends: R (>= 3.0.1)
Imports: rjson, plyr, assertthat, httr, leafletR (>= 0.1-1)
Built: R 3.6.0; ; 2019-06-02 00:44:19 UTC; windows
Thanks! really thanks, as I work primarily in this group of insects I was suffering the lack of information over gbif, I was hoping an interface like this a lot of time, thanks for posting this!. I've just installed this but I can't find the Author in the docs.
I found a problem in this example:
acd <- aw_data(genus = "acanthognathus")
aw_map(acd)Error en eval(expr, envir, enclos) :
objeto 'meta.decimal_latitude' no encontradoThats using stable version from CRAN, the package from the master branch just works.
For example with this code (the original error is in spanish but its only 'acd' not found), it happens too with other genera (cataglyphis, polyergus...):
anochetus_df <- aw_data(genus="anochetus")
aw_map(anochetus_df)
Error en which(names(acd) == "decimal_latitude") :
objeto 'acd' no encontrado
At a first glance I see the call of acd, but I can't see where is created in the function.
Here is my sessionInfo, just in case:
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C
[3] LC_TIME=es_ES.UTF-8 LC_COLLATE=C
[5] LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8
[7] LC_PAPER=es_ES.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] AntWeb_0.5.3
loaded via a namespace (and not attached):
[1] RCurl_1.95-4.1 assertthat_0.1 digest_0.6.4 httr_0.2 leafletR_0.1-1
[6] plyr_1.8 rjson_0.2.13 stringr_0.6.2 tools_3.0.2
Plenty of issues with v2
Hi,
I have been using aw_distinct to retrieve the names of species in certain groups, but was noticing some discrepancies between taxa retrieved and what is listed on AntWeb. It seems as though taxa lacking specimens are not retrieved. Is it possible to also retrieve the names of species that lack specimens? For instance, a search for species in Dorylus:
require("AntWeb")
dorylus<-aw_data(genus="Dorylus")
sort(unique(dorylus$data$scientific_name))
This does not seem to retrieve Dorylus atratus or Dorylus bishyiganus, which seem to be included in Dorylus (as a valid taxon) in AntWeb and AntCat:
https://www.antweb.org/browse.do?subfamily=dorylinae&genus=dorylus&rank=genus&project=worldants
http://antcat.org/catalog/436753
http://antcat.org/catalog/436761
Thanks much for your help.
-Matt
First draft of package is in place. Some obvious todos:
aw_data
call. It's a bit clunky at the moment.E.g.,
~$ http http://www.antweb.org/api/?genus=crematogaster
HTTP/1.0 500 Internal Server Error
Connection: close
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Date: Wed, 19 Feb 2014 20:33:06 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
http http://www.antweb.org/api/?genus=camponotus
gives the same thing
Subfamily
Genus
Species
Type (e.g. holotype)
Habitat This uses a wildcard so a query for ?habitat=sand will return any habitat containing the word sand (e.g. sandstone)
Bbox This is a bounded box of decimal coordinates in the format ?bbox=x1,y1,x2,y2
Date Query on a single date (?date=yyyy-mm-dd), or a date boundary (?date=yyyy-mm-dd,yyyy-mm-dd)
Elevation This is measured in meters. Query on a specific elevation (?elevation=1200), or a boundary (?elevation=1200,2000)
Georeferenced This is a boolean argument to filter for only geo referenced specimen (?georeferenced=true)
Limit Limit the number of specimen returned on large requests (?limit=100)
Offset Used to paginate large requests when paired with the limit argument (this would return records 300-400: ?limit=100&offset=300)
Jay added distinct.
I finally had the chance to add the distinct argument to the
coordinate function on the api.
So you can select a list of distinct species, genus or subfamilies in
a certain radius by using a query like this:
http://antweb.org/api/v2/?coord=37.76,-122.45&r=2&distinct=genus
I am new in this world, and i have a problem starting AntWeb searchs...any solutions?
was_df <- aw_data(genus = "wasmannia")
Error in function (type, msg, asError = TRUE) :
Failure when receiving data from the peer
Hello, first before I start complaining, thanks for producing this package!
aw_data works fine, but I've encountered an error using the mapping function aw_map, here's the code (it's just your example from the front-page), the execution and error/warning messages and my system info:
adf <- aw_data(genus = "acanthognathus", georeferenced = TRUE)
aw_map(adf)
adf <- aw_data(genus = "acanthognathus", georeferenced = TRUE)
No encoding supplied: defaulting to UTF-8.
No encoding supplied: defaulting to UTF-8.
475 results available for query.
!> aw_map(adf)
File saved under /var/folders/7x/4c5fkmrx5r54d6sgzglyffth0000gn/T//RtmpbSQcKP/temp.geojson
Error in if (is.na(s$col)) single.style <- append(single.style, ""stroke": false") else single.style <- append(single.style, :
argument is of length zero
In addition: Warning message:
In is.na(s$col) : is.na() applied to non-(list or vector) of type 'NULL'
"platform" "x86_64-apple-darwin13.4.0"
"arch" "x86_64"
"os" "darwin13.4.0"
"system" "x86_64, darwin13.4.0"
"status" ""
"major" "3"
"minor" "3.3"
"year" "2017"
"month" "03"
"day" "06"
"svn rev" "72310"
"language" "R"
"version.string" "R version 3.3.3 (2017-03-06)"
"nickname" "Another Canoe"
Hi @jaymollica here are a few suggestions
georeferenced
data from the API. Right now I filter on the client side and this is not ideal.application/json
rather than text/html
(thanks @sckott)limit
and offset
.meta.decimal_latitude
and others decimal_latitude
.images
method. What is the use case for someone to request images by days elapsed? Can I pass taxonomic levels here too?Create a leaflet.js
map similar to what we have in ecoengine
. Once I can figure out how to format tooltips, we should be able to add thumbnail images in addition to a description.
One could also build a nice Shiny app to showcase nearly all of the functionality in the package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.