R/example.R

Defines functions readr_example

Documented in readr_example

#' Get path to readr example
#'
#' readr comes bundled with a number of sample files in its `inst/extdata`
#' directory. This function make them easy to access
#'
#' @param path Name of file. If `NULL`, the example files will be listed.
#' @export
#' @examples
#' readr_example()
#' readr_example("challenge.csv")
readr_example <- function(path = NULL) {
  if (is.null(path)) {
    dir(system.file("extdata", package = "readr"))
  } else {
    system.file("extdata", path, package = "readr", mustWork = TRUE)
  }
}

Try the readr package in your browser

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

readr documentation built on May 2, 2019, 6:35 a.m.