Learn R Programming

ScienceBase R Tools

Tools for interfacing R with ScienceBase data services.

Package Description

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 (USGS IP-075498). See citation('sbtools') for how to cite the package.

Recommended Citation:

  Winslow, LA, S Chamberlain, AP Appling, and JS Read. 2016. sbtools: 
  A package connecting R to cloud-based data for collaborative online 
  research. The R Journal 8:387-398.

Package source code DOI: https://doi.org/10.5066/P912NGFV

LinuxTest Coverage

Current CRAN information

VersionMonthly DownloadsTotal Downloads

Package Installation

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

install.packages("sbtools")

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

remotes::install_github("DOI-USGS/sbtools")

Reporting bugs

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

https://github.com/DOI-USGS/sbtools/issues

Release Procedure

For release of the sbtools package, a number of steps are required.

  1. Ensure all checks pass and code coverage is adequate.
  2. Ensure NEWS.md reflects updates in version.
  3. Update DESCRIPTION to reflect release version.
  4. Convert DISCLAIMER.md to approved language and rebuild README.Rmd.
  5. Create release candidate branch and commit release candidate.
  6. Build source package and upload to CRAN.
  7. Once accepted to CRAN, tag release candidate branch an push to repositories.
  8. Change DISCLAIMER.md back to development mode and increment description version.
  9. Merge release candidate and commit.
  10. Open PR/MR in development state.

Disclaimer

This software is preliminary or provisional and is subject to revision. It is being provided to meet the need for timely best science. The software has not received final approval 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 functionality of the software and related material nor shall the fact of release constitute any such warranty. The software is provided on the condition that neither the USGS nor the U.S. Government shall be held liable for any damages resulting from the authorized or unauthorized use of the software.

Copy Link

Version

Install

install.packages('sbtools')

Monthly Downloads

302

Version

1.4.0

License

CC0

Issues

Pull Requests

Stars

Forks

Maintainer

David Blodgett

Last Published

July 7th, 2025

Functions in sbtools (1.4.0)

item_append_files

Upload File to Item
item_get_parent

Get an item's parent ID
item_list_files

Get list of files attached to SB item
item_list_children

Return IDs for all child items
item_exists

check if identifier touple already exists on SB
item_file_download

Download files attached to item
item_rm_files

Remove files associated with an item
sb_datatypes

Query SB for all available datatypes
item_upload_create

#' Upload file(s) and create a new item
item_replace_files

Replace files associated with an item
query_sb_datatype

Query SB for specific data type
item_rm

Remove item from SB
readPassword

Read in a password from the user
item_upload_cloud

Upload File to Item Cloud Storage
query_sb

Query SB for items using generic query parameters
session_validate

Validate sbtools session state
sbtools_PUT

generic PUTs for sbtools package
set_endpoint

Set SB endpoint
sbtools_POST

generic POSTs for sbtools package package wrapped for generic POSTs that test sessions internally and wrap some errors
item_rm_recursive

Remove an item completely by recursively removing its child items
query_items

Query SB for items using generic query parameters
session_details

Get session info (deprecated)
query_item_in_folder

Search within an SB folder
session_age

a convienence function for getting the age of a session.
session_renew

Checks current session and re-authenticates if necessary
session_expired

Check whether an SB session is expired
item_update

Update a SB item with new metadata
query_item_identifier

Query SB for items based on custom identifier
sbtools_GET

generic GETs for sbtools package
item_upsert

Upsert an SB item
token_stache_path

Get or set token stache data directory
query_sb_text

Query SB for items containing specific text
query_sb_spatial

Query SB based on spatial extent
sbtools-package

R interface to ScienceBase
item_update_identifier

Add custom identifier to an existing item
user_id

Get your parent ID
query_sb_date

Query SB for items within a date range
query_sb_doi

Query SB for specific DOI (Digital Object Identifier)
sb_ping

Ping ScienceBase to see if it's available
sbitem

ScienceBase item class
get_username

Get or set ScienceBase username
initialize_sciencebase_session

Initialize ScienceBase Session
get_cached_token

get cached sciencebase token
identifier_exists

Check if identifier exists
authenticate_sb

Authenticate to SB for subsequent calls [DEPRECATED]
is_logged_in

Check whether you're logged into a ScienceBase session
current_session

Return current cached session
item_create

Create a new SB item
folder_create

Create a folder
item_rename_files

Rename item attached files
item_move

Move item from one folder to another
item_publish_cloud

Publish file to public cloud S3 bucket
item_get

Retrieve SB item
item_get_fields

Retrieve specific fields from an SB item