USGS ScienceBase Tools

Tools for interacting with U.S. Geological Survey ScienceBase <> interfaces. ScienceBase is a data cataloging and collaborative data management platform. Functions included for querying ScienceBase, and creating and fetching datasets.

ScienceBase R Tools

Build Status Tools for interfacing R with ScienceBase data services.

This package provides a rich interface to USGS's ScienceBase, a data cataloging and collaborative data management platform. For further information, see the sbtools manuscript in The R Journal. See citation('sbtools') for how to cite the package.

Package Installation

To install the sbtools package, you must be using R 3.0 or greater and run the following command:


To get inter-CRAN release updates, use the command:


To get cutting-edge changes, install from GitHub using the devtools packages:


Reporting bugs

Please consider reporting bugs and asking questions on the Issues page:

Current CRAN information

Version Monthly Downloads Total Downloads
CRAN version


# Query ScienceBase for data about Antarctica
query_sb_text('Antarctica', limit=1)
## [[1]]
## <ScienceBase Item>
##   Title: Antarctica. Unnamed peak in the Nunataks near camp 18. January 21, 1978.
##   Creator/LastUpdatedBy:      / 
##   Provenance (Created / Updated):   / 
##   Children: 
##   Item ID: 51dc2e89e4b0f81004b79cf6
##   Parent ID: 519ba0a3e4b0e4e151ef5dd9
# Query for a specific DOI
## [[1]]
## <ScienceBase Item>
##   Title: 2013 Raw Ground Penetrating Radar Data on Alaska's Glaciers
##   Creator/LastUpdatedBy: /
##   Provenance (Created / Updated): 2015-06-15T16:55:03Z / 2015-12-15T20:39:06Z
##   Children: TRUE
##   Item ID: 557f0367e4b023124e8ef621
##   Parent ID: 5474ec49e4b04d7459a7eab2
# Inspect the contents of the above item
children <- item_list_children('557f0367e4b023124e8ef621')
sapply(children, function(child) child$title)
## [1] "Raw Ground Penetrating Radar Data, Valdez Glacier, Alaska; 2013"   
## [2] "Raw Ground Penetrating Radar Data, Gulkana Glacier, Alaska; 2013"  
## [3] "Raw Ground Penetrating Radar Data, Eklutna Glacier, Alaska; 2013"  
## [4] "Raw Ground Penetrating Radar Data, Eureka Glacier, Alaska; 2013"   
## [5] "Raw Ground Penetrating Radar Data, Taku Glacier, Alaska; 2013"     
## [6] "Raw Ground Penetrating Radar Data, Scott Glacier, Alaska; 2013"    
## [7] "Raw Ground Penetrating Radar Data, Wolverine Glacier, Alaska; 2013"
# Log in (requires a ScienceBase account) and create an item
authenticate_sb() # type in username and password
my_home_item <- user_id()
new_item <- item_create(title = 'new test item', parent_id = my_home_item)
test.txt <- file.path(tempdir(), 'test.txt')
writeLines(c('this is','my data file'), test.txt)
item_append_files(new_item, test.txt)
## [1] "test.txt"


This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey, an agency of the United States Department of Interior. For more information, see the official USGS copyright policy

Although this software program has been used by the U.S. Geological Survey (USGS), no warranty, expressed or implied, is made by the USGS or the U.S. Government as to the accuracy and functioning of the program and related program material nor shall the fact of distribution constitute any such warranty, and no responsibility is assumed by the USGS in connection therewith.

This software is provided "AS IS."


Version 1.1.3 (2016-08-18)

  • Fix items_create to properly handle cases creating one item

  • Add sbtools to user agent string

  • Alter item_list_children to use query_sb so item return limit can be > 1000. raw option removed to support this functionality.

Version 1.0.3 (2016-06-30)

  • Fix item_rm bug

Version 1.0.2 (2016-06-22)

  • Cleanup for CRAN release

Version 0.19.3 (2016-06-17)

  • Bunch of changes from reviews

  • item_get_parent now returns sbitem, not just ID

  • fixed probablem with query_sb_doi

  • query_sb_spatial no longer has awkard bounding box specification, just uses lat/long arrays and determines box from those

  • sb_ping returns boolean TRUE/FALSE for success/fail

  • set_endpoint no longer includes verbose message and properly uses match.arg

  • item_list_children now returns list of sbitem to be uniform with rest of sbtools

  • Lots of documentation updates and new demos

Version 0.18.5 (2016-06-01)

  • Fixed issue with query_sb_datatype

  • New and improved item_get_wfs. Better performance and no longer requires hard-to-install external dependencies.

Version 0.18.0 (2016-04-10)

  • Improved version of query_sb() now requests useful metadata so sbitem list has key metadata

  • query_item_identifier() now returns an sbitem list instead of a data.frame. Also, *_item_identifier() funcitons now have unified parameter order

Version 0.17.0 (2016-04-10)

  • On item_replace_files() changed default on all flag to FALSE so it doesn't delete files by default.

  • Added item_rename_files() to enable user to easily rename files attached to items directly.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


1.1.17 by David Blodgett, 6 months ago

Report a bug at

Browse source code at

Authors: David Blodgett [cre] , Luke Winslow [aut] , Scott Chamberlain [ctb] , Alison Appling [ctb] , Jordan Read [ctb]

Documentation:   PDF Manual  

Task views:

CC0 license

Imports jsonlite, curl, httr, stringr, methods

Suggests testthat, xml2, sf, sp

Imported by bbsBayes.

See at CRAN