Learn R Programming

rnoaa (version 0.1.0)

noaa_datatypes: Get possible data types for a particular dataset

Description

From the NOAA API docs: Describes the type of data, acts as a label. If it's 64 degrees out right now, then the data type is Air Temperature and the data is 64.

Usage

noaa_datatypes(datasetid = NULL, datatypeid = NULL, datacategoryid = NULL,
  stationid = NULL, locationid = NULL, startdate = NULL, enddate = NULL,
  sortfield = NULL, sortorder = NULL, limit = 25, offset = NULL,
  callopts = list(), token = getOption("noaakey",
  stop("you need an API key NOAA data")), dataset = NULL, page = NULL,
  filter = NULL)

Arguments

datasetid
Accepts a single valid dataset id. Data returned will be from the dataset specified, see datasets() (required)
datatypeid
Accepts a valid data type id or a chain of data type ids in a comma-separated vector. Data returned will contain all of the data type(s) specified (optional)
locationid
Accepts a valid location id or a chain of location ids in a comma-separated vector. Data returned will contain data for the location(s) specified (optional)
stationid
Accepts a valid station id or a chain of of station ids in a comma-separated vector. Data returned will contain data for the station(s) specified (optional)
startdate
Accepts valid ISO formated date (yyyy-mm-dd). Data returned will have data after the specified date. Paramater can be use independently of enddate (optional)
enddate
Accepts valid ISO formated date (yyyy-mm-dd). Data returned will have data before the specified date. Paramater can be use independently of startdate (optional)
sortfield
The field to sort results by. Supports id, name, mindate, maxdate, and datacoverage fields (optional)
sortorder
Which order to sort by, asc or desc. Defaults to asc (optional)
limit
Defaults to 25, limits the number of results in the response. Maximum is 1000 (optional)
offset
Defaults to 0, used to offset the resultlist (optional)
token
This must be a valid token token supplied to you by NCDC's Climate Data Online access token generator. (required) Get an API key (=token) at http://www.ncdc.noaa.gov/cdo-web/token. You can pass your token in as an argument or store it i
callopts
Further arguments passed on to the API GET call. (optional)
dataset
THIS IS A DEPRECATED ARGUMENT. See datasetid.
page
THIS IS A DEPRECATED ARGUMENT. There is no equivalent argument in v2 of the NOAA API.
filter
THIS IS A DEPRECATED ARGUMENT. There is no equivalent argument in v2 of the NOAA API.
datacategoryid
Optional. Accepts a valid data category id or a chain of data category ids seperated by ampersands (although it is rare to have a data type with more than one data category). Data types returned will be associated with the data category(ies) speci

Value

  • A data.frame for all datasets, or a list of length two, each with a data.frame.

Examples

Run this code
# Fetch available data types
noaa_datatypes()

# Fetch more information about the ACMH data type id
noaa_datatypes(datatypeid="ACMH")

# Fetch data types with the air temperature data category
noaa_datatypes(datacategoryid="TEMP", limit=56)

# Fetch data types that support a given set of stations
noaa_datatypes(stationid=c('COOP:310090','COOP:310184','COOP:310212'))

Run the code above in your browser using DataLab