camr_file_path: Determine Absolute Path to a File

View source: R/R02-Files_and_paths.R

camr_file_pathR Documentation

Determine Absolute Path to a File

Description

Function to find the absolute path to a file given a partial match to its name.

Usage

camr_file_path(partial_name, env_variable = NULL, folder = NULL, latest = TRUE)

Arguments

partial_name

A character string, the file name or part of the file name that can uniquely identify it from other files.

env_variable

An optional character string, an environmental variable listed in a .env file loaded into the R environment via the dotenv package. If provided, will be used as the source folder assumed to contain the file.

folder

An optional character string, the name of the folder (or part of the folder name that can uniquely identify it) containing the file. If the env_variable argument is provided, then the folder argument can be used to specify a subfolder containing the file.

latest

Logical; if TRUE the function will sort all matching file names and return the final one (if file names contain dates, this means the function returns the most recent file).

Value

A character string, an absolute path to a file.


rettopnivek/camrprojects documentation built on Dec. 20, 2024, 10:17 p.m.