Skip to content

Commit

Permalink
Lees docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Tasilee committed Mar 13, 2014
1 parent 58774af commit 7a0ec59
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 43 deletions.
2 changes: 2 additions & 0 deletions .Rprofile
@@ -0,0 +1,2 @@
install.packages("ALA4R",repos="http://rforge.net/",type="source")
library(ALA4R)
16 changes: 16 additions & 0 deletions ALA4R.Rproj
@@ -0,0 +1,16 @@
Version: 1.0

RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default

EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8

RnwWeave: Sweave
LaTeX: pdfLaTeX

BuildType: Package
PackageInstallArgs: --no-multiarch --with-keep.source
35 changes: 19 additions & 16 deletions R/autocomplete.R
@@ -1,27 +1,30 @@
#' Auto Complete Search
#'
#' This is an autocomplete search for identifying names & identifiers used at
#' ALA. It is used to provide a dataframe of scientific and common names that
#' can be used for further analysis that is a match from a supplied partial
#' name.
#' An autocomplete search for identifying species names & identifiers used at the ALA based
#' on matches from a PARTIAL NAME. atocomplete can generate a dataframe of scientific and
#' common names that can be used for further analysis in R.
#'
#' If the scientific name, common name or LSID are known, use fulltext_search
#'
#' @param taxon a character string that defines part of the scientific or
#' common name of the taxa of interest
#' @param geoOnly logical: if TRUE, only results that have some geospatial occurrence records will be included
#' @param idxType string: The index type to limit. Values include: TAXON REGION COLLECTION INSTITUTION DATASET
#' @param limit the maximum number of matches returned (defaults to the server-side value, which is currently 10)
#' @return A dataframe of taxa given the partial matches where columns are
#' identified as: \item{guid}{} \item{name}{} \item{occurrenceCount}{}
#' \item{georeferencedCount}{} \item{scientificNameMatches}{}
#' \item{commonNameMatches}{} \item{commonName}{} \item{matchedNames}{}
#' \item{ankId}{} \item{rankString}{} \item{left}{} \item{right}{}
#' @author Atlas of Living Australia \email{support@@ala.org.au}
#' @references \url{http://api.ala.org.au/}

#' @param taxon a character string of part of the scientific, common name of the taxa
#' @param geoOnly logical: if TRUE, only results that have geospatial occurrence records will be included
#' @param idxType string: The index type to limit. Values include: TAXON REGION COLLECTION INSTITUTION DATASET
#' @param limit the maximum number of matches returned (defaults to the server-side value - currently 10)
#' @return A dataframe of taxa given the partial matches where columns are identified as:
#' \item{guid}{} \item{name}{} \item{occurrenceCount}{}
#' \item{georeferencedCount}{} \item{scientificNameMatches}{}
#' \item{commonNameMatches}{}
#' \item{commonName}{}
#' \item{matchedNames}{} \item{ankId}{} \item{rankString}{} \item{left}{} \item{right}{}
#'
#' @examples
#'
#' #find information ALA holds on red kangaroo
#' #find information ALA holds on red kangaroo (Macropus Rufus)
#' autocomplete("red kangaroo")
#' autocomplete("Macropus Rufus",geoOnly=TRUE)
#'
#' @export autocomplete
autocomplete=function(taxon,geoOnly=FALSE,idxType=NULL,limit=NULL) {
Expand All @@ -44,7 +47,7 @@ autocomplete=function(taxon,geoOnly=FALSE,idxType=NULL,limit=NULL) {
this_query$limit=limit
}
if (geoOnly) {
this_query$geoOnly="true"
this_query$geoOnly="true" #Check for taxa that have locations (some have no location)
}
if (!is.null(idxType)) {
this_query$idxType=idxType
Expand Down
24 changes: 20 additions & 4 deletions R/fulltext_search.R
@@ -1,16 +1,32 @@
#' Full text search
#'
#' Performs a search across all objects, and selects the closest matches
#'
#' @param taxon a character string for the taxon of interest
#' @return a dataframe of information with columns being: \item{comp1
#' }{Description of 'comp1'}
#'
#' @author Atlas of Living Australia \email{support@@ala.org.au}
#' @references \url{http://api.ala.org.au/}
#'
#' @param taxon: a character string for the taxon of interest
#' @return a dataframe of information with columns being:
#' \item{comp1}{Description of 'comp1'}
#' $Results
#' \item{guid} \item{name} \item{idxtype}
#' \item{score} \item{parentGuid}
#' \item{commonName} \item{nameComplete}
#' \item{commonNameSingle} \item{hasChildren} \item{rank} \item{rankId} \item{rawRank} \item{conservationStatus} \item{conservationStatusAUS}
#' \item{isAustralian}
#' \item{highlight}
#' \item{image} \item{thumbnail} \item{left} \item{right} \item{kingdom}
#' \item{phylum} \item{class} \item{order} \item{class} \item{order} \item{family} \item{genus} \item{author}
#' \item{linkIdentifier} \item{occCount} \item{imageSource} \item{imageCount} \item{isEcluded}
#' \item{imageUrl} \item{largeImageUrl} \item{smallImageUrl} \item{thumbnailUrl} \item{imageMetadataUrl}
#' \item{acceptedConceptName} \item{synonomyRelationship} \item{synonomyDescription}
#'
#' @examples
#'
#' #find information ALA holds on red kangaroo
#' fulltext_search("red kangaroo")
#' fulltext_search("Macropus Rufus")
#' fulltext_search("urn:lsid:biodiversity.org.au:afd.taxon:31a9b8b8-4e8f-4343-a15f-2ed24e0bf1ae")
#'
#' @export
fulltext_search <- function(taxon) {
Expand Down
17 changes: 8 additions & 9 deletions R/species_info.R
@@ -1,22 +1,21 @@
#' Fetch species profile
#' Fetch a taxon profile given a scientific name or LSID
#'
#' Retrieve species profile given either the scientific name or GUID
#'
#'
#' @param scientificname string: scientific name of the species of interest
#' @param guid string: GUID of species of interest
#' @param verbose boolean value defining how much progress information to display; default is set by ala_config().
#' @return species profile in the form of a named list
#' @author Atlas of Living Australia \email{support@@ala.org.au}
#' @references \url{http://api.ala.org.au/}
#'
#' @param scientificname string: scientific name of the taxon of interest (species, genus, family etc)
#' @param LSID string: The Life Science Identifier of the taxon of interest
#' @param verbose boolean value: How much progress information to display; default is set by ala_config().
#' @return species profile in the form of a named list

#' @examples
#'
#' species_info("Grevillea humilis subsp. maritima")
#' species_info(guid="urn:lsid:biodiversity.org.au:apni.taxon:248651")
#'
#' @export species_info

# TODO: support multiple names or guids passed as a vector?
# TODO: support multiple names or guids passed as a vector? (LB:low priority)

species_info=function(scientificname=NULL,guid=NULL,verbose=ala_config()$verbose) {
if (is.null(scientificname) && is.null(guid)) {
Expand Down
28 changes: 14 additions & 14 deletions R/specieslist.R
@@ -1,23 +1,23 @@
#' Get list of taxa and occurrence counts
#'
#' Get list of taxa and their occurrence counts, matching a taxonomic query
#' and/or within a specified spatial area
#' Get list of taxa and their occurrence counts, with/without a matching
#' taxonomic query within an optionally-defined WKT-defined polygon
#'
#' @author Atlas of Living Australia \email{support@@ala.org.au}
#' @references \url{http://api.ala.org.au/}
#' \url{http://www.geoapi.org/3.0/javadoc/org/opengis/referencing/doc-files/WKT.html}
#'
#' @param taxon Taxonomic query, e.g. "macropus" or "macropodidae"
#' @param wkt A WKT (well-known text) string providing a spatial polygon within
#' which to search, e.g. "POLYGON((140 -37,151 -37,151 -26,140.1310 -26,140
#' -37))"
#' @param taxon: Text of taxon, e.g. "Macropus rufus" or "macropodidae"
#' @param wkt: Numeric vector string of WKT (well-known text) defining a polygon within
#' which to limit taxon search, e.g. "POLYGON((140 -37,151 -37,151 -26,140 -26,140 -37))"
#' @param page_size Maximum number of records to return (may not be honoured by
#' the ALA server). Default=NA, meaning that the server default value
#' (currently 10) will be used.
#' the ALA server). Default=NA, meaning that the server default value (currently 10) will be used.
#' @return Data frame with (at least) the columns
#' "Scientific.name","Common.name","Taxon.rank","LSID","N.occurrences"
#' @author Atlas of Living Australia \email{support@@ala.org.au}
#' @references \url{http://api.ala.org.au/}
#' \item {family} \item{Scientific.name} \item{Common.name} \item{Taxon.rank}
#' \item{GUID} \item{N.occurrences}
#' @examples
#'
#' x=specieslist(taxon="macropus",wkt="POLYGON((140 -37,151 -37,151 -26,140.1310 -26,140 -37))")
#' x=specieslist(taxon="macropus",wkt="POLYGON((140 -37,151 -37,151 -26,140 -26,140 -37))")
#' x=specieslist(wkt="POLYGON((140 -37,151 -37,151 -26,140 -26,140 -37))")
#' x=specieslist(wkt="POLYGON((147.62 -42.83,147.60 -42.86,147.65 -42.87,147.70 -42.86,147.62 -42.83))",page_size=30)
#'
#' @export specieslist
specieslist=function(taxon="",wkt="",page_size=NA) {
Expand Down

0 comments on commit 7a0ec59

Please sign in to comment.