Created
February 18, 2016 14:31
-
-
Save btupper/aa6a05c82ee89c4151ad to your computer and use it in GitHub Desktop.
Extras for R rerddap package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Browse a dataset webpage. | |
#' | |
#' Note that it is an error to call this when \code{base::interactive()} returns FALSE | |
#' | |
#' @export | |
#' | |
#' @param datasetid Dataset id | |
#' @param x A datasetid or the output of \code{info} | |
#' @param url A URL for an ERDDAP server. Default: \url{http://upwell.pfeg.noaa.gov/erddap/} | |
#' @param ... Further args passed on to \code{\link[httr]{BROWSE}} (must be a named parameter) | |
#' @return the value returned by \code{\link[httr]{BROWSE}} | |
#' @examples \dontrun{ | |
#' ed_browse('noaa_esrl_28d5_ac3a_bb06') | |
#' } | |
ed_browse <- function(x, url = eurl(), ...){ | |
stopifnot(interactive()) | |
if (missing(x)) stop("datasetid is required") | |
uri <- sprintf(paste0(url, 'info/%s/index.html'), datasetid) | |
httr::BROWSE(uri, ...) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment