R/data_file_path.R

Defines functions data_file_path

Documented in data_file_path

#' Return the file path to data files
#'
#' @description
#' Access mydata.xlsx and other files in inst/extdata folder
#'
#'
#' @param path Name of file in quotes with extension, e.g. "mydata.xlsx"
#'
#' @returns String of the path to the specified file
#' @export
#'
#'
#' @examples
#' data_file_path()
#'
#' data_file_path("mydata.xlsx")
#'
data_file_path <- function(path = NULL) {
  if (is.null(path)) {
    dir(system.file("extdata", package = "ConSciR"))
  } else {
    system.file("extdata", path, package = "ConSciR", mustWork = TRUE)
  }
}

Try the ConSciR package in your browser

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

ConSciR documentation built on Nov. 5, 2025, 5:25 p.m.