This function locates a file within a specified folder in the current project directory or its subdirectories.
It can search across multiple folders and prompt the user to select a folder if multiple folders with the specified name are found.
Arguments
- file
A character string specifying the name of the file to be located.
- ...
Additional arguments to specify options such as the folder name. The default folder is `"data"`.
Value
A character string representing the file path if the file is found. An error is thrown if the file is not found.
Details
This function searches for a specified file within a folder and its sub-directories. If multiple folders
matching the specified name exist, the user is prompted to select one. If no folder is found or if the file does not exist
in the chosen folder, an error is returned.
Examples
if (FALSE) { # \dontrun{
# Locate a file named "data.csv" in the "data" folder
guides::guide_to_file("data.csv", folder = "data")
# Locate a file named "results.txt" in the default "data" folder
guides::guide_to_file("results.txt")
} # }