diff --git a/NAMESPACE b/NAMESPACE index 44d8f0a7..edcab4f7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,5 +1,6 @@ # Generated by roxygen2: do not edit by hand +export(bcdc_browse) export(bcdc_facets) export(bcdc_list) export(bcdc_map) diff --git a/R/bcdc_browse.R b/R/bcdc_browse.R new file mode 100644 index 00000000..cbbbb0fa --- /dev/null +++ b/R/bcdc_browse.R @@ -0,0 +1,36 @@ +# Copyright 2018 Province of British Columbia +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +#' Load the B.C. Data Catalogue URL into an HTML browser +#' +#' This is a wrapper around utils::browseURL with the URL for the B.C. Data Catalogue as +#' the default +#' +#' @inheritParams utils::browseURL +#' @param url a non-empty character string giving the URL to be loaded. Default \code{https://catalogue.data.gov.bc.ca}. +#' +#' @seealso \code{\link[utils]{browseURL}} +#' @return A browser is opened with the B.C. Data Catalogue URL loaded: nothing is returned to the R interpreter +#' +#' @export +#' +#' @examples +#' bcdc_browse() +bcdc_browse <- function(url = "https://catalogue.data.gov.bc.ca", browser = getOption("browser"), + encodeIfNeeded = FALSE) { + + utils::browseURL(url = url, browser = browser, + encodeIfNeeded = encodeIfNeeded) + } + + + diff --git a/README.Rmd b/README.Rmd index aacda082..fc479455 100644 --- a/README.Rmd +++ b/README.Rmd @@ -30,7 +30,7 @@ knitr::opts_chunk$set( Being designed and built, but in the lab. May change, disappear, or be buggy.[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)[![Travis build status](https://travis-ci.org/bcgov/bcdc.svg?branch=master)](https://travis-ci.org/bcgov/bcdc) -# bcdc +# bcdata An R package 📦 for searching & retrieving data from the [B.C. Data Catalogue]( https://catalogue.data.gov.bc.ca). diff --git a/README.md b/README.md index a01bd8c5..b7b1a22b 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ See the License for the specific language governing permissions and limitations build status](https://travis-ci.org/bcgov/bcdc.svg?branch=master)](https://travis-ci.org/bcgov/bcdc) -# bcdc +# bcdata An R package 📦 for searching & retrieving data from the [B.C. Data Catalogue](https://catalogue.data.gov.bc.ca). diff --git a/man/bcdc_browse.Rd b/man/bcdc_browse.Rd new file mode 100644 index 00000000..c2a32bac --- /dev/null +++ b/man/bcdc_browse.Rd @@ -0,0 +1,41 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/bcdc_browse.R +\name{bcdc_browse} +\alias{bcdc_browse} +\title{Load the B.C. Data Catalogue URL into an HTML browser} +\usage{ +bcdc_browse(url = "https://catalogue.data.gov.bc.ca", + browser = getOption("browser"), encodeIfNeeded = FALSE) +} +\arguments{ +\item{url}{a non-empty character string giving the URL to be loaded. Default \code{https://catalogue.data.gov.bc.ca}.} + +\item{browser}{a non-empty character string giving the name of the + program to be used as the HTML browser. It should be in the PATH, + or a full path specified. Alternatively, an \R function to be + called to invoke the browser. + + Under Windows \code{NULL} is also allowed (and is the default), and + implies that the file association mechanism will be used. + } + +\item{encodeIfNeeded}{Should the URL be encoded by + \code{\link{URLencode}} before passing to the browser? This is not + needed (and might be harmful) if the \code{browser} program/function + itself does encoding, and can be harmful for \samp{file://} URLs on some + systems and for \samp{http://} URLs passed to some CGI applications. + Fortunately, most URLs do not need encoding.} +} +\value{ +A browser is opened with the B.C. Data Catalogue URL loaded: nothing is returned to the R interpreter +} +\description{ +This is a wrapper around utils::browseURL with the URL for the B.C. Data Catalogue as +the default +} +\examples{ +bcdc_browse() +} +\seealso{ +\code{\link[utils]{browseURL}} +}