knitr::opts_chunk$set( comment = "#>", warning = FALSE, message = FALSE, cache = TRUE )
HOMR
(Historical Observing Metadata Repository) provides climate station metadata. It's a NOAA service.
Find out more about HOMR at http://www.ncdc.noaa.gov/homr/ and the HOMR API at http://www.ncdc.noaa.gov/homr/api.
library('rnoaa')
You can do this in various ways. Using the qid
parameter (stands or qualified ID, as far as I know), you can search by suffix (e.g., 046742
), or both separated by a colon (e.g., COOP:046742
).
By station suffix
res <- homr(qid = ':046742') names(res) names(res[['20002078']]) res$`20002078`[1:3]
By both
res <- homr(qid = 'COOP:046742') names(res) names(res[['20002078']]) res$`20002078`[1:5]
You can also search by station identifier, which is different from the qid
above.
res <- homr(station=20002078) names(res) names(res[['20002078']]) res$`20002078`[4:6]
By state
res <- homr(state='DE', begindate='2005-01-01', enddate='2005-02-01') names(res)
By country
res <- homr(country='GHANA', begindate='2005-01-01', enddate='2005-02-01') library("plyr") ldply(res, function(x) x$location$latlon)
By state and county
res <- homr(state='NC', county='BUNCOMBE', headersOnly = TRUE) head( ldply(res, "[[", "head") )
res <- homr(headersOnly=TRUE, state='DE') head( ldply(res, "[[", "head") )
The data returned is the same format for all, so a separate function is provided to get metadata. The function homr_definitions()
does query the HOMR API, so does get updated metadata - i.e., it's not a static dataset stored locally.
head( homr_definitions() )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.