EarthChem {GCDkit}R Documentation

Import from EarthChem.org

Description

This function serves for importing the whole-rock geochemical data from EarthChem.org online database. Since 2010, EarthChem has been part of IEDA (Integrated Earth Data Applications), the National Science Foundation (NSF)-funded data facility for solid earth geoscience data. The data are gathered from several publicly available databases such as PetDB, SedDB, NAVDAT, or are contributed, and can be accessed through the EarthChem's REST Search Service utilized by our function.

Usage

EarthChem(x)

Arguments

x

a list of parameters, given below, detailed account of which is to be found at the web page with the EarthChem REST Server Documentation

. See also Examples.

Details

The function EarthChem imports the specified data taking advantage of the EarthChem REST Search Service, which accepts GET string variables that determine search criteria. The results are returned using html or xml protocols, and can be then imported to the GCDkit using the library 'XML'.

Possible parameters are (in square brackets are GCDkit default values)

Data source specification (reference(s))
author author
title title of the article
journal journal
doi Digital Object Identifier (not always available)
minpubyear minimum publication year of the citation article
maxpubyear maximum publicationyear (reqd with the former option)
exactpubyear exact year of publication
keyword free-text generic descriptor field
Sample ID, location or age
sampleid sample number/identifier from the original database
polygon geographic region, specified by geographic coordinates
north, east, south, west coordinates of a geographic envelope, all to be provided together
minage minimum age of the sample (Ma)
maxage maximum age of the sample (Ma)
exactage age of the sample (Ma)
geologicalage geological age
material either 'bulk', 'whole rock', 'glass' or 'inclusion'
Output format
searchtype type of search, only 'rowdata' (table of items matching the criteria)
is implemented so far [rowdata].
outputtype either 'html' or 'xml' [html]
outputlevel either 'sample' or 'method' [sample]
startrow sequence number of the first output row minus 1 [0]
endrow sequence number of the last output row minus 1 [number_of_hits-1]
standarditems logical; output just the standard items? [yes]
outputitems comma-separated list of output items
showcolumnnames logical; import the names of variables? [yes]

Value

(Invisibly) the query string. If no hits were found, the function returns (again invisibly) the value -1.

Imports the data into the GCDkit system. Stores the imported dataset into memory (i.e., the variable WRCube) together with the fields source that contains the string "EarthChem" and date with tome of the search, EarthChem.query.var with the query variable (a list) and EarthChem.query.url with URL sent to the web service.

Then, the previously active dataset becomes the current one.

Warning

XML library is required.

Author(s)

Function by Vojtech Janousek, vojtech.janousek@geology.cz (with helpful assistance from Jason Ash, jasonash@ku.edu).

Tcl/Tk GUI by Oscar Laurent, oscar.laurent@erdw.ethz.ch

The XML package was written by Duncan Temple Lang.

See Also

For further details, see the EarthChem REST Server Documentation.

Examples

# Some of these examples are based on original examples 
# from  http://ecp.iedadata.org/rest_search_documentation 
   
   EarthChem(list(author="smith",outputtype="html",showcolumnnames="yes",startrow=0,endrow=100,
     outputitems="sample_id,source,longitude,latitude"))
   
   EarthChem(list(author="janousek",outputtype="xml",showcolumnnames="yes",outputitems="sample_id,
     source,longitude,latitude",standarditems="yes"))

   EarthChem(list(author="moyen",outputtype="html",showcolumnnames="yes",outputitems=
     "sample_id,source,longitude,latitude",standarditems="yes"))

   EarthChem(list(geologicalage="cambrian",outputtype="html",startrow=0,endrow=100,
     outputitems="sample_id,source,longitude,latitude"))
   
   EarthChem(list(polygon="-101.953125 39.9375,-99.95625 39.9375,-100.603125 38.53125, -99.815625 
     36.95625,-101.98125 36.984375,-101.953125 39.9375",searchtype="rowdata",outputtype="html",
     outputitems="sampleid",showcolumnnames="yes",standarditems="yes"))

# Read a map directly into R
   query<-"http://ecp.iedadata.org/restsearchservice?
     north=49&east=-100&south=23&west=-24&outputtype=staticmap"
   #shell.exec(query) # easy solution, gets to browser
   filename<-paste(gcdx.dir,"map.jpg",sep="/")
   download.file(query,filename,method="internal",mode="wb")
   shell.exec(filename)

[Package GCDkit version 6.0 Index]