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,GUI=FALSE)

EarthChemC(x,GUI=FALSE)

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.

GUI

logical; is the function called from the GUI?

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 function EarthChemC is just EarthChem, compiled for speed. 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)
misnumber 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 Vojtěch Janoušek, vojtech.janousek@geology.cz (with helpful assistance from Jason Ash, jasonash@ku.edu).

Tcl/Tk GUI by Oscar Laurent, oscar.laurent@get.omp.eu

The XML package was written by Duncan Temple Lang.

See Also

For further details, see the EarthChem Resources for Developers and, in particular, EarthChem REST Server Documentation

Examples

    ## Not run: 
        # Some of these examples are based on original examples 
        # from  http://portal.earthchem.org/rest_search_documentation 
   
        # The whole dataset
        EarthChemC(list(author="ackerman",outputtype="html",showcolumnnames="yes",
            outputitems="sample_id,source,longitude,latitude"))
        plotDiagram("TAS",FALSE,TRUE)
        
        # Just 50 records  
        EarthChemC(list(author="ackerman",outputtype="html",showcolumnnames="yes",startrow=0,endrow=50,
            outputitems="sample_id,source,longitude,latitude"))  

        # Read the first 100 Cambrian samples
        EarthChemC(list(geologicalage="cambrian",outputtype="html",startrow=0,endrow=100,
            outputitems="sample_id,source,longitude,latitude"))
        
        # Different values of outputtype just invoke different parsers, the results should be identical      
        EarthChemC(list(author="janousek",outputtype="xml",
            outputitems="sample_id,source,longitude,latitude"))
            
        EarthChemC(list(author="janousek",outputtype="html",
            outputitems="sample_id,source,longitude,latitude"))    

        # Read a static map directly into R
        # Samples from the eastern United States and adjacent part of Atlantic Ocean (EarthChem REST example)
        query<-"http://portal.earthchem.org/restsearchservice?
            north=49&east=-100&south=23&west=-24&outputtype=staticmap"
        shell.exec(query) # opens in browser
    
## End(Not run)

[Package GCDkit version 6.1 Index]