R/example.R

Defines functions tinsel_example tinsel_examples

Documented in tinsel_example tinsel_examples

#' Get Path of a Tinsel Example File
#'
#' \code{tinsel_example} simplifies getting and returns the system path of an
#' example file included in the tinsel package. To list the names of all example
#' files use \code{tinsel_examples}.
#'
#' @param path Name of the example file.
#'
#' @keywords internal
#' @export
#' @examples
#' # list all example files
#' tinsel_examples()
#'
#' # get the path of a specific example
#' tinsel_example('attributes.R')
tinsel_example <- function(path) {
  system.file('exfiles', path, package = 'tinsel', mustWork = TRUE)
}

#' @rdname tinsel_example
#' @export
tinsel_examples <- function() {
  dir(system.file('exfiles', package = 'tinsel', mustWork = TRUE))
}

Try the tinsel package in your browser

Any scripts or data that you put into this service are public.

tinsel documentation built on May 2, 2019, 1:30 p.m.