R/example.R

Defines functions miplicorn_example

Documented in miplicorn_example

#------------------------------------------------
#' Get path to miplicorn examples
#'
#' miplicorn contains several example files in its 'inst/extdata' directory.
#' This function can be used to access file paths.
#'
#' @param path Name of file. If `NULL`, all example files will be listed.
#'
#' @return A local filepath or a list of all available files.
#'
#' @aliases example
#' @export
#' @examples
#' # Get path to one example
#' miplicorn_example("reference_AA_table.csv")
#'
#' # List all available examples
#' miplicorn_example()
miplicorn_example <- function(path = NULL) {
  if (is.null(path)) {
    dir(system.file("extdata", package = "miplicorn"))
  } else {
    system.file("extdata", path, package = "miplicorn", mustWork = TRUE)
  }
}
bailey-lab/miplicorn documentation built on March 19, 2023, 7:40 p.m.